Skip to content

Enum values missing in OpenAPI 3.1 schema #4835

Open
@jochenberger

Description

@jochenberger

I'm using 2.2.28.
I have the following classes:

    class Question {
        @ArraySchema(schema = @Schema(description = "The answer to the question"))
        public Set<Option> answer;
    }

    enum Option {
        A, B, C, D
    }

The OpenAPI 3 schema looks like this:

Question:
type: object
properties:
  answer:
    uniqueItems: true
    type: array
    items:
      type: string
      description: The answer to the question
      enum:
      - A
      - B
      - C
      - D

When I switch to OpenAPI 3.1, I get:

Question:
type: object
properties:
  answer:
    type: array
    items:
      description: The answer to the question
    uniqueItems: true

I can work around this by adding implementation = Option.class to the inner @Schema annotation, e.g. @ArraySchema(schema = @Schema(description = "The answer to the question", implementation = Option.class)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions