ajv-validator / ajv-validator/ajv
Discriminator-Property not working in `allOf`
- Lingua principale
- TypeScript
- Stelle
- 14.8k
- Fork
- 1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**What version of Ajv are you using? Does the issue happen if you use the latest version?**
8.12.0
**JSON Schema**
```json
{
"type": "object",
"discriminator": {
"propertyName": "type"
},
"oneOf": [
{
"allOf": [
{
"$ref": "#/components/schemas/A"
},
{
"type": "object",
"required": ["type"],
"properties": {
"method": {
"type": "string",
"enum": ["a"]
}
}
}
]
},
{
"allOf": [
{
"$ref": "#/components/schemas/B"
},
{
"type": "object",
"required": ["type"],
"properties": {
"method": {
"type": "string",
"enum": ["b"]
}
}
}
]
}
]
}
```
When accessing the schema from above, I get this error:
`Error: discriminator: oneOf subschemas (or referenced schemas) must have "properties/type"`
For me this Schema seems to be valid, but there seems to be a problem with this nested oneOf / allOf structure.
Is there a way to solve this, because I would like to stay with this Schema which is autogenerated from the backend.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.