Newer
Older
notebooks / behaverse / validators / test.schema.json
{
  "definitions": {
    "c1": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "c1": {"type": "object"}
      }
    },
    "c2": {
      "type": "string"
    }
  },
  "type": "object",
  "properties": {
      "base": {
        "type": "object"
      },
      "types": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "enum": ["c1", "c2", "c3"]
          }
      },
      "custom": {
        "oneOf": [
          {
            "if": {
              "properties": {
                "types": {
                  "type": "array",
                  "contains": {"type":"string", "enum": ["c1"]}}}},
            "then": {
              "$ref": "#/definitions/c1"
            }
          },
          {
            "if": {
              "properties": {
                "types": {
                  "type": "array",
                  "contains": {"type":"string", "enum": ["c2"]}}}},
            "then": {
              "$ref": "#/definitions/c2"
            }
          }
        ]
      }
  },
  "required": [ "base", "types", "custom" ]
}