-
Notifications
You must be signed in to change notification settings - Fork 38
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
Preserve descriptions of $ref types #1157
Comments
I have implemented this logic in PR #1168. |
Hi @jankuca, sorry for the delay, I've been away the past week 🙏. As you've suggested this is a limitation of the OpenAPI 3.0 specification. Whilst your solution solves for your use case, conditional inlining based on presence of a comment is quite tailored and implicit - the generated OpenAPI document would deviate structurally from the SPOT contract. I did a little bit of digging into this issue from the OpenAPI perspective and it appears it has been an active topic in the community - and has been addressed in the upcoming OpenAPI 3.1 specification (see OpenAPI 3.1 RC1 | Reference Object - reference objects will allow |
@lfportal Yeah, that makes total sense and it by far the cleanest way to go. I didn't know about the proposal and I love seeing this. We are using redoc for generating documentation for our API. I am not sure about the support for the proposal there as of right now but I expect the project to adhere to future versions of OpenAPI eventually. I can continue using my workaround until then. |
Currently, when there is an aliased type used, the JSDoc description is lost in favor of the description of the aliased type.
The
AliasedType
is turned into acomponents/schema
item with the description preserved whereas the body property "x" loses the description. This is due to the OpenAPI format limitation which does not allow descriptions for$ref
schemas.I think it would be a nice fix (optional possibly) to inline the aliased types when used together with a JSDoc description.
The code above would effectively be the same as
The only way to preserve the descriptions is currently inlining the types manually and having a lot of duplication within the API Spot definition.
The text was updated successfully, but these errors were encountered: