{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "FrontAid CMS Schema", "description": "JSON Schema definition for FrontAid CMS", "type": "object", "properties": { ":name": { "title": "Name of the project model", "type": "string", "minLength": 1 }, ":description": { "title": "Description of the project model", "type": "string", "minLength": 1 }, ":locales": { "title": "Optional list of locales (the first is the default)", "type": "array", "items": {"type": "string", "pattern": "^[a-zA-Z][a-zA-Z0-9-_.]*$"}, "minItems": 1 } }, "patternProperties": { "^[a-zA-Z][a-zA-Z0-9_-]*$": {"$ref": "#/definitions/nodeOrField"} }, "required": [ ":name" ], "additionalProperties": false, "allOf": [ {"$ref": "#/definitions/enforceProp"} ], "definitions": { "enforceProp": { "$comment": "Enforce at least one custom property.", "if": {"required": [":name", ":description"]}, "then": { "minProperties": 3 }, "else": { "if": {"required": [":name"]}, "then": {"minProperties": 2}, "else": { "if": {"required": [":description"]}, "then": {"minProperties": 2}, "else": {"minProperties": 1} } } }, "nodeOrField": { "oneOf": [ {"$ref": "#/definitions/object"}, {"$ref": "#/definitions/listObject"}, {"$ref": "#/definitions/line"}, {"$ref": "#/definitions/text"}, {"$ref": "#/definitions/image"} ] }, "object": { "title": "Node", "type": "object", "properties": { ":name": {"type": "string"}, ":description": {"type": "string"} }, "patternProperties": { "^[a-zA-Z][a-zA-Z0-9_-]*$": {"$ref": "#/definitions/nodeOrField"} }, "additionalProperties": false, "allOf": [ {"$ref": "#/definitions/enforceProp"} ] }, "listObject": { "title": "List node", "type": "object", "properties": { ":name": {"type": "string"}, ":description": {"type": "string"}, ":items": { "type": "object", "minProperties": 1, "$comment": "Only custom properties allowed here", "patternProperties": { "^[a-zA-Z][a-zA-Z0-9_-]*$": {"$ref": "#/definitions/nodeOrField"} }, "allOf": [ {"$ref": "#/definitions/enforceProp"} ], "additionalProperties": false } }, "required": [":items"], "additionalProperties": false }, "line": { "title": "Short single-line text", "type": "object", "properties": { ":name": {"type": "string"}, ":description": {"type": "string"}, ":type": {"const": "line"}, ":richtext": {"type": "boolean"} }, "required": [":type"], "additionalProperties": false }, "text": { "title": "Default text field", "type": "object", "properties": { ":name": {"type": "string"}, ":description": {"type": "string"}, ":type": {"const": "text"}, ":richtext": {"type": "boolean"} }, "required": [":type"], "additionalProperties": false }, "image": { "title": "Image field", "type": "object", "properties": { ":name": {"type": "string"}, ":description": {"type": "string"}, ":type": {"const": "image"} }, "required": [":type"], "additionalProperties": false } } }