swagger-core
swagger-core copied to clipboard
Override description for items in array schema
I'm using OpenAPI 3.1.
I have the following classes:
class Street {
@ArraySchema(schema = @Schema(implementation = House.class, description = "A house in a street"))
public List<House> houses;
}
@Schema(description = "A house")
class House {
public String number;
}
The generated YAML looks like this:
Street:
type: object
properties:
houses:
type: array
items:
$ref: "#/components/schemas/House"
House:
type: object
description: A house
properties:
number:
type: string
The description for the items is not included.
If I remove the implementation = House.class from the inner schema definition, I get
Street:
type: object
properties:
houses:
type: array
items:
description: A house in a street
House:
type: object
description: A house
properties:
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.