1
Fork 0
mirror of https://github.com/xivdev/EXDSchema.git synced 2025-06-07 08:37:45 +00:00
EXDSchema/SchemaValidator/SchemaSchema.json

214 lines
5.7 KiB
JSON
Raw Normal View History

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Sheet",
"type": "object",
"additionalProperties": false,
"properties": {
"sheet": {
"$ref": "#/definitions/Sheet"
}
},
"definitions": {
"Sheet": {
"title": "Sheet",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "The name of the sheet.",
"type": "string"
},
"displayField": {
"description": "The name of the field to use for displaying a reference to this sheet in a cell. Useful only for UI-based consumption.",
"type": "string"
},
"fields": {
"description": "The fields of the sheet. Sheets must specify all fields present in the EXH file for that sheet, meaning they all must have at least one field.",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/Field"
}
},
"comment": {
"type": "string"
}
},
"oneOf": [
{ "required": ["name", "fields"] }
]
},
"Field": {
"description": "A field in a sheet. Describes one or more columns.",
"title": "Field",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "The name of the field.",
"type": "string"
},
"type": {
"description": "Defines the type of the field. Scalar should be assumed by default, and has no meaning. The only other type that affects parsing is array.",
"type": "string",
"enum": ["scalar", "link", "array", "icon", "modelId", "color"]
},
"count": {
"description": "Only valid for array types. Defines the number of elements in the array.",
"type": "integer"
},
"targets": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
},
"condition": {
"$ref": "#/definitions/Condition"
},
"fields": {
"description": "Only valid for array types. Defines the fields of the array. Fields are not available on non-array types because grouping non-array types is meaningless. They should be defined at the top-level.",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/Field"
}
},
"comment": {
"type": "string"
}
},
"allOf": [
{
"description": "Arrays require a count.",
"if": {
"required": ["type"],
"properties": {
"type": {
"const": "array"
}
}
},
"then": {
"required": ["count"]
},
"else": {
"not": {
"required": ["count"]
}
}
},
{
"description": "Fields with a fields list must be an array.",
"if": {
"required": ["fields"]
},
"then": {
"required": ["type"],
"properties": {
"type": {
"const": "array"
}
}
}
},
{
"description": "Fields with a count must be an array.",
"if": {
"required": ["count"]
},
"then": {
"required": ["type"],
"properties": {
"type": {
"const": "array"
}
}
}
},
{
"description": "Fields can have only one of condition or targets.",
"allOf": [
{
"description": "Fields with targets cannot have a condition.",
"if": {
"required": ["targets"]
},
"then": {
"not": {
"required": ["condition"]
}
}
},
{
"description": "Fields with a condition cannot have targets.",
"if": {
"required": ["condition"]
},
"then": {
"not": {
"required": ["targets"]
}
}
},
{
"description": "Arrays can have neither condition or targets.",
"not": {
"required": ["condition", "targets"]
}
}
]
},
{
"description": "Fields with a link type must have a condition or targets.",
"if": {
"required": ["type"],
"properties": {
"type": {
"const": "link"
}
}
},
"then": {
"oneOf": [
{
"required": ["condition"],
"not": {
"required": ["targets"]
}
},
{
"required": ["targets"],
"not": {
"required": ["condition"]
}
}
]
}
}
]
},
"Condition": {
"title": "Condition",
"type": "object",
"additionalProperties": false,
"properties": {
"switch": {
"type": "string"
},
"cases": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"required": ["cases", "switch"]
}
}
}