Files
brainwave/content/schema/hexagram-content.schema.json
T

118 lines
3.2 KiB
JSON
Raw Normal View History

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://brainwave.invalid/schema/hexagram-content-v1.json",
"title": "Brainwave local hexagram content package",
"type": "object",
"additionalProperties": false,
"required": [
"schemaVersion",
"contentVersion",
"specialUsageTexts",
"sources",
"hexagrams"
],
"properties": {
"schemaVersion": { "const": 1 },
"contentVersion": { "type": "string", "minLength": 1 },
"specialUsageTexts": {
"type": "object",
"additionalProperties": false,
"required": ["qian", "kun"],
"properties": {
"qian": { "type": "boolean" },
"kun": { "type": "boolean" }
}
},
"sources": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/source" }
},
"hexagrams": {
"type": "array",
"minItems": 64,
"maxItems": 64,
"items": { "$ref": "#/$defs/hexagram" }
}
},
"$defs": {
"nonBlankText": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"trigram": {
"enum": ["QIAN", "DUI", "LI", "ZHEN", "XUN", "KAN", "GEN", "KUN"]
},
"polarity": {
"enum": ["YIN", "YANG"]
},
"source": {
"type": "object",
"additionalProperties": false,
"required": ["id", "title", "edition", "license", "url"],
"properties": {
"id": { "$ref": "#/$defs/nonBlankText" },
"title": { "$ref": "#/$defs/nonBlankText" },
"edition": { "$ref": "#/$defs/nonBlankText" },
"license": { "$ref": "#/$defs/nonBlankText" },
"url": { "type": "string", "format": "uri" }
}
},
"sixPolarities": {
"type": "array",
"minItems": 6,
"maxItems": 6,
"items": { "$ref": "#/$defs/polarity" }
},
"sixTexts": {
"type": "array",
"minItems": 6,
"maxItems": 6,
"items": { "$ref": "#/$defs/nonBlankText" }
},
"hexagram": {
"type": "object",
"additionalProperties": false,
"required": [
"kingWenNumber",
"name",
"symbol",
"lowerTrigram",
"upperTrigram",
"patternBottomUp",
"judgmentOriginal",
"judgmentPlain",
"lineTextsBottomUp",
"linePlainBottomUp",
"specialUsageText",
"sourceRefs"
],
"properties": {
"kingWenNumber": { "type": "integer", "minimum": 1, "maximum": 64 },
"name": { "$ref": "#/$defs/nonBlankText" },
"symbol": { "$ref": "#/$defs/nonBlankText" },
"lowerTrigram": { "$ref": "#/$defs/trigram" },
"upperTrigram": { "$ref": "#/$defs/trigram" },
"patternBottomUp": { "$ref": "#/$defs/sixPolarities" },
"judgmentOriginal": { "$ref": "#/$defs/nonBlankText" },
"judgmentPlain": { "$ref": "#/$defs/nonBlankText" },
"lineTextsBottomUp": { "$ref": "#/$defs/sixTexts" },
"linePlainBottomUp": { "$ref": "#/$defs/sixTexts" },
"specialUsageText": {
"oneOf": [
{ "$ref": "#/$defs/nonBlankText" },
{ "type": "null" }
]
},
"sourceRefs": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "$ref": "#/$defs/nonBlankText" }
}
}
}
}
}