-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Generate relations in openapi.json #3572
Comments
@KyDenZ, could you please translate your use case to English? :) @raymondfeng, what's your thought on this? Thanks. |
Yes, sorry :) |
I am confused. Are you @KyDenZ asking the model schemas to include properties for accessing related models? We have recently added support for that, see #2631, #2630 and #3171. Example usage: Or do you perhaps refer to Link Object (the spec) that can be used to describe navigation from operations related to one model to operations related to another model? Let's discuss & clarify. |
I did not think you had to add "include" to generate relationships in models in the openApi json. Actually it works now. Thank you @bajtos ! One question: Is it possible to generate a single model that contains all the information (like the loopback generator 3 for Angular) with relations, id, attributes ... To avoid having dozens of models with long quite long name ? |
Great, I am glad for that 👍
I am afraid that's not possible if you want the OpenAPI spec to accurately describe the request & response schemas.
I suppose you could modify your API to use the same schema with the following options:
This will simplify your client at the cost of reduced validations. |
Suggestion
When an entity contains a relationship attribute (hasMany, hasOne), this one is not generated in the openapi.json file.
Use Cases
I want to use, as part of React, the generator Typescript-axios. It generates the entities well, but without the relations.
Acceptance criteria
TBD - will be filled by the team.
The text was updated successfully, but these errors were encountered: