Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openapi: listing collections don't document returning a kind field #111

Open
cben opened this issue Feb 24, 2020 · 1 comment
Open

openapi: listing collections don't document returning a kind field #111

cben opened this issue Feb 24, 2020 · 1 comment

Comments

@cben
Copy link
Contributor

cben commented Feb 24, 2020

I notice none of the method List { blocks contain an out Kind String parameter.
And indeed the generated openapi documents kind for individual objects corresponding to method Get eg. /api/clusters_mgmt/v1/clusters/{cluster_id} but not for collection lists e.g. /api/clusters_mgmt/v1/clusters

@nimrodshn @jhernand I can send a PR to add those, will that be enough?

I see generated server code has special logic to return correct Kind, including link vs full object.
Will it automatically also return kind for lists?

@jhernand
Copy link
Collaborator

Yes, the generated server code automatically returns the "kind" attribute also for lists. For example, this is the generated server code that returns the cluster list: https://github.com/openshift-online/ocm-sdk-go/blob/6997f79338819f63753b9156c9a8ecbb8537a230/clustersmgmt/v1/clusters_resource_json.go#L106-L157

And this is the part of the generator that takes care of that: https://github.com/openshift-online/ocm-api-metamodel/blob/a92c173afbff673a56219f427f20b20ab9a1778d/pkg/generators/golang/json_generator.go#L1007-L1041

I believe that what needs to be changed is the code that generates the OpenAPI specification. Most probably this method: https://github.com/openshift-online/ocm-api-metamodel/blob/a92c173afbff673a56219f427f20b20ab9a1778d/pkg/generators/openapi/openapi_generator.go#L316-L343

@cben cben changed the title openapi: listing collections don't document returning a mind field openapi: listing collections don't document returning a kind field Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants