I have a schema object definition like this in mine swagger.yaml:
User:
type: object
properties:
username:
type: string
description: the user name
colors:
type: array
items: {
type: string,
enum: [ "red", "blue", "green" ]
}
description: user must have one or more colors associated
required:
- username
- colors
However, the generated server is still happy to accept POST requests using this schema object as a required body parameter that does not contain a field colors.
Can I configure Swagger so that the field is coloralways required in the schematic object Userand ideally should also contain at least one or more of the elements from the enumeration?
source
share