Schema discriminator property must match a property with the same name
Issue ID: semantic-discriminator-value
Description
The discriminator of the schema in question must match a property with the same name.
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 value is animalType
but the defined property is actually called petType
:
{
"definitions": {
"Pet": {
"type": "object",
"discriminator": "animalType",
"properties": {
"name": {
"type": "string"
},
"petType": {
"type": "string"
}
},
"required": [
"name",
"animalType"
]
}
}
}
Remediation
Make sure that all discriminator values match defined properties.
{
"definitions": {
"Pet": {
"type": "object",
"discriminator": "petType",
"properties": {
"name": {
"type": "string"
},
"petType": {
"type": "string"
}
},
"required": [
"name",
"petType"
]
}
}
}