-
-
Notifications
You must be signed in to change notification settings - Fork 524
Warning on referenced example #437
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
Comments
Can you add the complete example on your description, in order to address it. Please have a look at out contribution guide on the section Using GitHub Issues: |
Having forked https://github.com/springdoc/springdoc-openapi-demos in https://github.com/EstebanDugueperoux2/springdoc-openapi-demos/commit/47e750587cb91398cc70133c074c754bd582285a To reproduce, launch springdoc-openapi-test-app2 example:
Get swagger from
Check it with https://editor.swagger.io/ and see the warning. |
I have added a fix for it; It will be available on v1.2.31. |
Thanks. |
Describe the bug
I'm developing HTTP JSON API based on SpringDoc OpenAPI3, but to avoid JSON example formating issues, I prefer to externalize them and reference them like that:
And in a @configuration class, I use a OpenApiCustomiser to provide these examples.
The issue is that if I don't provide @example's name, it doesn't appears in generated swagger.
And if I provide a name like:
It appears but with a description attribute:
which make a warning using https://editor.swagger.io/ saying "Sibling values are not allowed alongside $refs". If I remove manually "description" attribute I have no more this warning.
Indeed this description is redundant with one from '#/components/examples/http200GetCharacteristicsExample'.
When analyzing I see an issue in org.springdoc.core.SpringDocAnnotationsUtils.setExamples(MediaType, ExampleObject[])
which don't consider ref when a single example is provided without name but consider it as an embedded example.
The text was updated successfully, but these errors were encountered: