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

Description for array schema is being ignored when generating OpenAPI 3.1

Open jochenberger opened this issue 9 months ago • 2 comments

I have the following Java code:

class Street {
        @ArraySchema(schema = @Schema(implementation = House.class, description = "A house in the street"),
                     arraySchema = @Schema(description = "The houses in the street"))
        public List<House> houses;
}

When generating OpenAPI 3.0, I get

Street:
type: object
properties:
  houses:
    type: array
    description: The houses in the street
    items:
      $ref: "#/components/schemas/House"

The item description is missing, but that's another issue (https://github.com/swagger-api/swagger-core/issues/3900). However, when I generate OpenAPI 3.1, I get

Street:
type: object
properties:
  houses:
    type: array
    items:
      $ref: "#/components/schemas/House"
      description: A house in the street

Now, the item description is there, but the array description is missing.

jochenberger avatar Jan 21 '25 07:01 jochenberger