yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

openapi discriminators

Open dave-yotta opened this issue 2 years ago • 0 comments

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 🤔

dave-yotta avatar Nov 23 '23 16:11 dave-yotta