-
Notifications
You must be signed in to change notification settings - Fork 9k
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 3.1.0 support: OpenAPI 3.1 type: […, "null"] incomplete support in parameters #9056
Comments
I'm confused:
So openApi generated by smallrye with Quarkus3.17 is valid according to JSON-Schema (using the The question is: Is it possible to get a nicely rendered swagger-ui (with type-info not deeply nested but at the top like in the screenshot) with valid openApi.yaml according to [2] |
@ChMThiel there isn't any conflict here. What @MikeEdgar seems to be pointing out is that if you So you have to use What's different about the example that I answered is that the two options were 1.) have both types in the same |
Ok, than Afaik the anyOf was orginaly intend to be used for multiple types (like inheritance: e.g. anyOf plant: tree, bush, flower, etc.) In such a case the 3.1.0-way of rendereing is just fine. The special case that a value has just one type (in my example a LocalTime) but can be null is a very common thing (at least in my APIs). Rendering that special case in swagger-ui as 'ordinary' anyOf's is imho not optimal (compared with the 'old' 3.0.3 way: in 3.0.3 you see the 'real' local-time type on first level; in 3.1.0 you have expand/klick all the way down, at first glance on first level it looks like a string-value). Isn't there a posibility that swagger-ui renders the type/null-information at least for one type/null anyOf's in a better way and not so deeply nested? |
When using |
I'm using quarkus that generates the openApi.yml - with All i`m pointing out is that the type-info in the special case that a value has just one type but can be null, is rendered not as comprehensive as it was in OpenAPi 3.0.3. |
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
https://gist.github.com/commonism/7adcb666278f4070b8f7aabd456faa43
Describe the bug you're encountering
The rendering of the parameters does not reflect the use of OpenAPI 3.1 type as a list.
The use of "null" as list element to indicate "nullable" is not reflected as well.
To reproduce...
Steps to reproduce the behavior:
Paste the yaml to swagger editor.
Expected behavior
Screenshots
Bad types for Response & header
all Parameters
Callback Response
but works for a RequestBody
Additional context or thoughts
type: […, "null"]
is the preferable way to define nullable in v3.1, using the alternativeanyOf: […,{type: "null"}]
instead results in a additional/unnecessary level of indirection in models generated from description documents.The text was updated successfully, but these errors were encountered: