Skip to content

Instantly share code, notes, and snippets.

@dima117
Created December 10, 2016 10:03
Show Gist options
  • Save dima117/cc81d49c7ea6b997cc41bcac18ce4813 to your computer and use it in GitHub Desktop.
Save dima117/cc81d49c7ea6b997cc41bcac18ce4813 to your computer and use it in GitHub Desktop.
{
"$ref": "#/definitions/set",
"definitions": {
"set": {
"type": ["string", "object", "array"],
"switch": [
{
"if": { "type": "object" },
"then": { "$ref": "#/definitions/entity" }
},
{
"if": { "type": "array" },
"then": {
"minItems": 1,
"items": {
"type": ["string", "object"],
"switch": [
{
"if": { "type": "object" },
"then": { "$ref": "#/definitions/entity" }
}
]
}
}
}
]
},
"entity": {
"type": "object",
"minProperties": 1,
"additionalProperties": false,
"properties": {
"block": { "type": "string" },
"elem": { "$ref": "#/definitions/elemPlainEntity" },
"elems": {
"type": ["string", "object", "array"],
"switch": [
{
"if": { "type": "object" },
"then": { "$ref": "#/definitions/elemEntity" }
},
{
"if": { "type": "array" },
"then": {
"minItems": 1,
"items": {
"type": ["string", "object"],
"switch": [
{
"if": { "type": "object" },
"then": { "$ref": "#/definitions/elemEntity" }
}
]
}
}
}
]
},
"mod": { "type": "string" },
"val": {
"type": ["string", "boolean"],
"switch": [
{
"if": { "type": "boolean" },
"then": { "enum": [true] }
}
]
},
"mods": { "$ref": "#/definitions/modifiers" },
"tech": { "type": "string" }
},
"dependencies": {
"elem": {
"not": { "required": ["elems"] }
},
"mod": {
"not": { "required": ["mods"] }
},
"val": { "required": ["mod"] }
}
},
"elemPlainEntity": {
"type": ["string", "array"],
"minItems": 1,
"items": { "type": "string" }
},
"elemEntity": {
"type": "object",
"additionalProperties": false,
"properties": {
"elem": { "$ref": "#/definitions/elemPlainEntity" },
"mods": { "$ref": "#/definitions/modifiers" },
"tech": { "type": "string" }
},
"required": ["elem"]
},
"modifiers": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"type": ["boolean", "string", "array"],
"switch": [
{
"if": { "type": "boolean" },
"then": { "enum": [true] }
},
{
"if": { "type": "array" },
"then": {
"minItems": 1,
"items": { "type": "string" }
}
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment