swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Override description for items in array schema

Open jochenberger opened this issue 10 months ago • 6 comments

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.

jochenberger avatar Dec 04 '24 10:12 jochenberger