yaml-language-server
yaml-language-server copied to clipboard
openapi discriminators
I am 90% sure discriminators such as the below are openapi dialect, so not sure if yaml language server is supposed to support this schema definition.
"typebase": {
"type": "object",
"discriminator": {
"propertyName": "discriminator",
"mapping": {
"type1": "#/definitions/type1",
"type2": "#/definitions/type2"
}
},
"x-abstract": true,
"additionalProperties": false,
"required": [
"code",
"discriminator"
],
"properties": {
"code": {
"type": "string"
},
"discriminator": {
"type": "string"
}
}
},
Will I need to replace with if-then constructs to get the properties changing based on discriminator value? This stuff is confusing for me so maybe I made some other mistake!
Edit: can work with allOf and if-then, but with support for jsonschema <=7 can't use "unevaluatedProperties": false to restrict additional properties 🤔