-
Notifications
You must be signed in to change notification settings - Fork 82
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
No way to specify a SchemaType.ARRAY items example schema #445
Labels
Comments
Azquelt
pushed a commit
to Azquelt/microprofile-open-api
that referenced
this issue
Mar 17, 2022
Maven plugin for SmallRye Open API
Something like this should work. @Schema(name = "DayOfWeek", example = "MONDAY")
enum DayOfWeek {
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
}
@Schema(name = "Pojo")
class Pojo {
Set<DayOfWeek> weekDays;
} When using the SmallRye OpenAPI implementation the resulting schemas look like this: "components" : {
"schemas" : {
"DayOfWeek" : {
"enum" : [ "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY" ],
"type" : "string",
"example" : "MONDAY"
},
"Pojo" : {
"type" : "object",
"properties" : {
"weekDays" : {
"uniqueItems" : true,
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/DayOfWeek"
}
}
}
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
..unless Im missing something.
I want to configure the example that will be present in an array.
As in the case below I want the example to be 'MONDAY':
To achieve this I try:
But the example is not at the item level as I need it, but at the weekDays property level.
How can I generate an items example?
The text was updated successfully, but these errors were encountered: