-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Schema description of one field overrides descriptions of other fields of same class #3900
Comments
According to the specification all properties except I would say that it is more consistent behavior to always ignore (maybe with a warning) any properties of the Looks like the restriction on the |
Looks like it was adopted in 3.1.0: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-19 |
It's indeed adopted in 3.1.0 |
This issue still exists in 2.2.15 at least. |
is the issue fixed in OAS 3.1 or do we need to do something different in the code?
|
Still issue with swagger-ui 5.2.0, camel-openapi 4.3.0 and springdoc-openapi-starter 2.2.0. Not sure which is in effect.
|
Me and @garciagiovane found the solution at this documentation at section If we document variables that have the same type, and they have different schemas with different descriptions, at compile time the last variable description will overwrite the other ones because they have the same type. |
See #3561 |
Following OAI/OpenAPI-Specification#2033, would it be possible to generate something like this? "components" : {
"schemas" : {
"RouteDto" : {
"type" : "object",
"properties" : {
"startPoint" : {
"description" : "Point where the route begins",
"allOf" : [
"$ref" : "#/components/schemas/GeoPointDto"
]
},
"intermediatePoint" : {
"description" : "Intermediate point of the route",
"allOf" : [
"$ref" : "#/components/schemas/GeoPointDto"
]
},
"endPoint" : {
"description" : "Point where the route ends",
"allOf" : [
"$ref" : "#/components/schemas/GeoPointDto"
]
}
}
},
"GeoPointDto" : {
"type" : "object",
"properties" : {
"lon" : {
"type" : "number",
"description" : "Longitude of geo point ( -180, 180 >",
"format" : "double"
},
"lat" : {
"type" : "number",
"description" : "Latitude of geo point < -90, 90 >",
"format" : "double"
}
}
}
}
} |
Unfortunately, there doesn't seem to be a way to have the schema generated like that. The |
Let's take an example of two simple classes:
Expected behavior is to have three fields inside RouteDto with different descirption each.
Actual behavior is that all fields has same description = "Point where the route ends" which is the description of third field.
UI:
JSON:
The text was updated successfully, but these errors were encountered: