-
Notifications
You must be signed in to change notification settings - Fork 189
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
Only primitive component fields retain their doc comments #137
Comments
Yes that is not actually bug but unimplemented by desing. Since OpenAPI 3.0 version does not have However OpenAPI 3.1 spec does have these values withing the reference object (https://spec.openapis.org/oas/latest.html#reference-object). This is something that could be supported future since currently it follows the OpenAPI 3.0 spec as much as possible. |
Hm, that's very unfortunate. Would it be possible to enable it via a feature flag, like |
Yes, it could be added, only thing is to see whether the Swagger UI will support it as well. It actyally has been my plan to support 3.0 and 3.1 versions but not been the priority since there are still more important things to get out of the way first. But if that comforts at all this could be done in not too distant future. :) Along with this the feature flag should also take care that other 3.1 version related properties work as well as expected. |
Thanks, that would be great! :) |
Yeah I agree.. Sorry for late reply I have been recently really busy and thus I have had no time to invest to the library at all. |
@juhaku Is there a way to contact you for sponsoring your work on certain issues, like the comments for all fields? This issue is quite important for us :) |
@oliver-impero Unfortunately not at the moment, I haven't fully set it up, My original goal was to have the github sponsors up and runnig but haven't finalized the setup. I need the get it done in the near future indeed. But but I can take a look at this after I fix #132 :) But in a long run, of course all sponsorships and support and contributions are welcome and will help to advance the library to become even more awesome :) And especially sponsorships would give me bigger reason to prioritize some of the work over the others. |
Getting back to this I tried this out with editor.swagger.io only to find out that Swagger UI is unable to render OpenAPI version greater than {
"$ref": "#/schemas/components/Item",
"description": "This is custom description"
} Lint warning suggest that aforementioned type would be wrapped with {
"allOf": [
"$ref": "#/schemas/components/Item",
"description": "This is custom description for the Item"
]
} This way Swagger UI is able to override shown description for the referenced type, but currently this behaviour is not supported. The description still won't render as a field description but instead will override the component description for the field. Drawback of this implementation is that Swagger UI will loose the type definition of the field since the above example actually creates a new anonymous object which is combination of the Implementing this functionality needs some designing and changes to existing behaviour. Also this would only consern OpenAPI |
Closing due inactivity. |
Can this issue be re-opened? I'm running into this same issue where I can't add a description to $ref types, any sort of workaround would be great. (Or perhaps this is dependent on 3.1 support in #531 ?) |
This actually is dependant to OpenAPI 3.1 support. 3.0 there is no way to this. Whenever the 3.1 support will come this will naturally be supported as well. Thus no separate issue is needed IMO. |
For some reason (bug?), only primitive component fields seem to retain their doc comments (but not fields that are custom types/newtypes), e.g.:
Code
Screenshot of Swagger UI
The text was updated successfully, but these errors were encountered: