Newer
Older
notebooks / behaverse / validators / test.schema.json
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
        "base": {
          "type": "object"
        },
        "types": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": ["AppStarted", "AppActivated"]
            }
        }
    },
    "required": [ "base", "types", "custom" ],
    "allOf": [
      {
        "if": { "properties": { "types": { "contains": { "const": "AppStarted" }}}},
        "then": { "properties": { "custom": { "$ref": "#/definitions/AppStarted" }}}
      },
      {
        "if": { "properties": { "types": { "contains": { "const": "AppActivated" }}}},
        "then": { "properties": { "custom": { "$ref": "#/definitions/AppActivated" }}}
      }
    ]
  },

  "definitions": {
    "AppActivated": {
      "type": "object",
      "properties": {
        "id": { "type": "number" }
      },
      "required": ["id"]
    },
    "AppStarted": {
      "type": "string"
    }
  }

}