You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Override description for items in array schema #4802
classStreet {
@ArraySchema(schema = @Schema(implementation = House.class, description = "A house in a street"))
publicList<House> houses;
}
@Schema(description = "A house")
classHouse {
publicStringnumber;
}
If I remove the implementation = House.class from the inner schema definition, I get
Street:
type: objectproperties:
houses:
type: arrayitems:
description: A house in a streetHouse:
type: objectdescription: A houseproperties:
number:
type: string
Now the description is there, but the $ref is gone.
I'd expect the item definition to contain both the $ref and the description in both cases.
With 2.2.28, I get the correct result with @ArraySchema(schema = @Schema(implementation = House.class, description = "A house in a street")), but it still does not work without the implementation = House.class. I think that this should be determined by the library.
Activity
jochenberger commentedon Dec 4, 2024
FTR, If I use OpenAPI 3.0, I only get the
$refin both cases, with and without theimplementation = House.class.jochenberger commentedon Dec 4, 2024
For single-valued properties, the description can be set.
For example,
results in
jochenberger commentedon Dec 5, 2024
See also #4753
jochenberger commentedon Dec 6, 2024
If seems to work if I use
@ArraySchema(schema = @Schema(allOf = House.class, description = "A house in a street"))I end up with
... type: array items: description: A house in a street allOf: - $ref: "#/components/schemas/House"which is correct but unnecessarily complicated in OpenAPI 3.1.
jochenberger commentedon Jan 17, 2025
With 2.2.28, I get the correct result with
@ArraySchema(schema = @Schema(implementation = House.class, description = "A house in a street")), but it still does not work without theimplementation = House.class. I think that this should be determined by the library.jochenberger commentedon May 14, 2025
Same result with 2.2.31.
jochenberger commentedon Jul 31, 2025
Might be fixed with #4944