swagger-core
swagger-core copied to clipboard
Enum values missing in OpenAPI 3.1 schema
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)).