259 lines
8.0 KiB
JSON
259 lines
8.0 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "Document Theme Component System",
|
|
"description": "A schema for a theme that defines reusable components and their layout.",
|
|
"type": "object",
|
|
"properties": {
|
|
"header": { "$ref": "#/$defs/headerObject" },
|
|
"settings": { "$ref": "#/$defs/settingsObject" },
|
|
"content": { "$ref": "#/$defs/contentRootObject" }
|
|
},
|
|
"required": ["header", "settings", "content"],
|
|
"$defs": {
|
|
"headerObject": {
|
|
"type": "object",
|
|
"properties": { "theme": { "$ref": "#/$defs/themeObject" } },
|
|
"required": ["theme"]
|
|
},
|
|
"themeObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"author": { "type": "string" },
|
|
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" }
|
|
},
|
|
"required": ["name", "author", "version"]
|
|
},
|
|
"settingsObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"page size": { "type": "string", "enum": ["A4", "A5", "Letter", "Legal"] },
|
|
"margin": { "$ref": "#/$defs/marginObject" }
|
|
},
|
|
"required": ["page size"]
|
|
},
|
|
"contentRootObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"settings": { "$ref": "#/$defs/contentSettingsObject" },
|
|
"cover": { "$ref": "#/$defs/pageSection" },
|
|
"backcover": { "$ref": "#/$defs/pageSection" },
|
|
"interior": { "$ref": "#/$defs/pageSection" }
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"contentSettingsObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"definitions": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/definitionObject" }
|
|
}
|
|
},
|
|
"required": ["definitions"]
|
|
},
|
|
"definitionObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"class": { "type": "string" },
|
|
"content": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/componentItem" }
|
|
}
|
|
},
|
|
"required": ["class", "content"]
|
|
},
|
|
"pageSection": {
|
|
"type": "object",
|
|
"properties": {
|
|
"settings": {
|
|
"type": "object",
|
|
"properties": {
|
|
"paper color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
|
"margin": { "$ref": "#/$defs/marginObject" }
|
|
},
|
|
"required": ["paper color"]
|
|
},
|
|
"contents": { "type": "array", "items": { "$ref": "#/$defs/contentItem" } }
|
|
},
|
|
"required": ["settings", "contents"]
|
|
},
|
|
"marginObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"top": { "$ref": "#/$defs/measurementObject" },
|
|
"bottom": { "$ref": "#/$defs/measurementObject" },
|
|
"left": { "$ref": "#/$defs/measurementObject" },
|
|
"right": { "$ref": "#/$defs/measurementObject" }
|
|
},
|
|
"required": ["top", "bottom", "left", "right"]
|
|
},
|
|
"measurementObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"value": { "type": "number" },
|
|
"unit": { "type": "string", "enum": ["cm", "mm", "in", "pt", "px"] }
|
|
},
|
|
"required": ["value", "unit"]
|
|
},
|
|
"contentItem": {
|
|
"type": "object",
|
|
"description": "An item with absolute position on a page.",
|
|
"properties": {
|
|
"coordinates": { "$ref": "#/$defs/coordinatesObject" },
|
|
"information": { "$ref": "#/$defs/informationUnion" }
|
|
},
|
|
"required": ["coordinates", "information"]
|
|
},
|
|
"componentItem": {
|
|
"type": "object",
|
|
"description": "An item within a component definition, without absolute coordinates.",
|
|
"properties": {
|
|
"information": { "$ref": "#/$defs/informationUnion" }
|
|
},
|
|
"required": ["information"]
|
|
},
|
|
"informationUnion": {
|
|
"oneOf": [
|
|
{ "$ref": "#/$defs/drawingInformation" },
|
|
{ "$ref": "#/$defs/textInformation" },
|
|
{ "$ref": "#/$defs/documentBodyInformation" },
|
|
{ "$ref": "#/$defs/imageInformation" }
|
|
]
|
|
},
|
|
"coordinatesObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"x": { "$ref": "#/$defs/positionRange" },
|
|
"y": { "$ref": "#/$defs/positionRange" },
|
|
"layer": { "type": "integer" }
|
|
},
|
|
"required": ["x", "y", "layer"]
|
|
},
|
|
"positionRange": {
|
|
"type": "object",
|
|
"properties": {
|
|
"start": { "type": "number" },
|
|
"end": { "type": "number" }
|
|
},
|
|
"required": ["start"]
|
|
},
|
|
"drawingInformation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": { "const": "drawing" },
|
|
"dimension": { "$ref": "#/$defs/dimensionObject" },
|
|
"relative position": { "$ref": "#/$defs/relativePositionObject" },
|
|
"rotation": { "type": "number" },
|
|
"shape": {
|
|
"oneOf": [
|
|
{ "$ref": "#/$defs/rectangleShape" },
|
|
{ "$ref": "#/$defs/lineShape" }
|
|
]
|
|
},
|
|
"line": { "$ref": "#/$defs/lineObject" },
|
|
"fill": { "$ref": "#/$defs/fillObject" },
|
|
"settings": {
|
|
"type": "object",
|
|
"properties": {
|
|
"padding": { "$ref": "#/$defs/marginObject" },
|
|
"skip margin": { "type": "boolean" }
|
|
}
|
|
}
|
|
},
|
|
"required": ["type", "shape"]
|
|
},
|
|
"textInformation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": { "const": "text" },
|
|
"font": { "$ref": "#/$defs/fontObject" },
|
|
"variable": { "type": "string", "pattern": "^\\$.+" }
|
|
},
|
|
"required": ["type", "font", "variable"]
|
|
},
|
|
"documentBodyInformation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": { "const": "document body" },
|
|
"font": { "$ref": "#/$defs/fontObject" },
|
|
"variable": { "type": "string", "pattern": "^\\$.+" }
|
|
},
|
|
"required": ["type", "font", "variable"]
|
|
},
|
|
"imageInformation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": { "const": "image" },
|
|
"dimension": { "$ref": "#/$defs/dimensionObject" },
|
|
"relative position": { "$ref": "#/$defs/relativePositionObject" }
|
|
},
|
|
"required": ["type", "dimension"]
|
|
},
|
|
"dimensionObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"width": { "$ref": "#/$defs/measurementObject" },
|
|
"height": { "$ref": "#/$defs/measurementObject" },
|
|
"layer": { "type": "integer" }
|
|
},
|
|
"required": ["width", "height", "layer"]
|
|
},
|
|
"relativePositionObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"horizontal": { "type": "string", "enum": ["left", "center", "right"] },
|
|
"vertical": { "type": "string", "enum": ["top", "center", "bottom"] }
|
|
},
|
|
"required": ["horizontal", "vertical"]
|
|
},
|
|
"fontObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"size": { "type": "number" },
|
|
"name": { "type": "string" }
|
|
},
|
|
"required": ["size", "name"]
|
|
},
|
|
"rectangleShape": {
|
|
"type": "object",
|
|
"properties": {
|
|
"type": { "const": "rectangle" },
|
|
"corner radius": { "$ref": "#/$defs/cornerRadiusObject" }
|
|
},
|
|
"required": ["type"]
|
|
},
|
|
"lineShape": {
|
|
"type": "object",
|
|
"properties": { "type": { "const": "line" } },
|
|
"required": ["type"]
|
|
},
|
|
"cornerRadiusObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"top left": { "type": "number" },
|
|
"top right": { "type": "number" },
|
|
"bottom left": { "type": "number" },
|
|
"bottom right": { "type": "number" }
|
|
},
|
|
"required": ["top left", "top right", "bottom left", "bottom right"]
|
|
},
|
|
"lineObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"stroke": { "type": "string", "enum": ["solid", "dashed", "dotted"] },
|
|
"width": { "type": "number" },
|
|
"color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" }
|
|
},
|
|
"required": ["stroke", "width", "color"]
|
|
},
|
|
"fillObject": {
|
|
"type": "object",
|
|
"properties": {
|
|
"color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
|
"opacity": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
},
|
|
"required": ["color"]
|
|
}
|
|
}
|
|
} |