Value of the schema discriminator must be a required property
Issue ID: v3-semantic-discriminator-required
Description
The discriminator
property in the schema in question has not been listed as a required property.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this issue could look in your API definition. Here, the discriminator petType
is not included in the required properties:
{
"Pet": {
"type": "object",
"discriminator": {
"propertyName": "petType"
},
"properties": {
"name": {
"type": "string"
},
"petType": {
"type": "string"
}
},
"required": [
"name"
]
}
}
Remediation
Make sure that all discriminators are listed as required properties.
{
"Pet": {
"type": "object",
"discriminator": {
"propertyName": "petType"
},
"properties": {
"name": {
"type": "string"
},
"petType": {
"type": "string"
}
},
"required": [
"name",
"petType"
]
}
}