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)).
Probably related to #4802
This seems to be specific to ArraySchema.
If I omit the schema = @Schema(description = "The answer to the question"), the enum values are present.
Still an issue in 2.2.34 btw.
Hi @jochenberger! I’ve reviewed your PR and it does indeed restore enum and ref support in OAS 3.1 for ArraySchemas.
I have created a PR based on yours to confirm that your changes also fix the refs issue you had created earlier.
Thank you for your input!
Is there any way to add the Bug label to existing issues? It looks as if the issue list could use some categorization.
I fixed this in https://github.com/swagger-api/swagger-core/pull/4944.