Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum values missing in OpenAPI 3.1 schema #4835

Open
jochenberger opened this issue Jan 17, 2025 · 2 comments
Open

Enum values missing in OpenAPI 3.1 schema #4835

jochenberger opened this issue Jan 17, 2025 · 2 comments

Comments

@jochenberger
Copy link

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)).

@jochenberger
Copy link
Author

Probably related to #4802

@jochenberger
Copy link
Author

This seems to be specific to ArraySchema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant