{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "JSON Schema tibi-server field configuration", "description": "tibi-server field linter", "type": "object", "additionalProperties": false, "patternProperties": { "^x\\-": { "description": "template property" } }, "properties": { "name": { "type": "string", "description": "name of field", "pattern": "^[0-9a-zA-Z_]+$" }, "type": { "enum": [ "string", "string[]", "number", "number[]", "boolean", "object", "object[]", "file", "file[]", "date", "any" ] }, "index": { "type": "array", "items": { "enum": [ "single", "unique", "text", "sparse", "background" ] } }, "subFields": { "oneOf": [ { "$comment": "for include tag", "type": "string" }, { "type": "array", "description": "sub fields of object", "items": { "oneOf": [ { "$comment": "for include tag", "type": "string" }, { "$ref": "#" } ] } } ] }, "validator": { "type": "object", "description": "field validator", "additionalProperties": false, "properties": { "required": { "type": "boolean", "description": "force field as required" }, "allowZero": { "type": "boolean", "description": "allow for required fields that the value can be an empty string or 0 for number type" }, "eval": { "type": "string", "description": "javascript validator which failes if evaluates to false or string as error message, with following variables: $this, $parent, $stack, $auth, context" }, "minLength": { "type": "number", "description": "minimum string length" }, "maxLength": { "type": "number", "description": "maximum string length" }, "pattern": { "type": "string", "description": "regex pattern the value must match" }, "min": { "type": "number", "description": "minimum value for number fields" }, "max": { "type": "number", "description": "maximum value for number fields" }, "in": { "type": "array", "description": "array of allowed values" }, "maxFileSize": { "type": "string", "description": "maximum decoded file size for file and file[] fields (e.g. '500KB')" }, "accept": { "type": "array", "description": "allowed MIME types for file and file[] fields; supports wildcards like 'image/*'", "items": { "type": "string" } } } }, "readonly": { "description": "field-level readonly — boolean or JS eval expression", "oneOf": [ { "type": "boolean" }, { "type": "object", "additionalProperties": false, "properties": { "eval": { "type": "string", "description": "JS expression that returns boolean" } }, "required": ["eval"] } ] }, "hidden": { "description": "field-level hidden — boolean or JS eval expression", "oneOf": [ { "type": "boolean" }, { "type": "object", "additionalProperties": false, "properties": { "eval": { "type": "string", "description": "JS expression that returns boolean" } }, "required": ["eval"] } ] }, "strictFields": { "type": "boolean", "description": "reject unknown sub-fields not defined in subFields" }, "meta": { "$ref": "fieldMeta.json" } }, "required": [ "name", "type" ] }