tibi-types/schemas/api-config/field.json
Sebastian Frank 14da32bac6
All checks were successful
continuous-integration/drone/push Build is passing
updated schema for contentbuilder and refactored code
2022-11-18 18:59:36 +00:00

86 lines
2.6 KiB
JSON

{
"$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",
"date",
"any"
]
},
"index": {
"type": "array",
"items": {
"enum": ["single", "unique", "text"]
}
},
"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"
}
}
},
"meta": {
"$ref": "fieldMeta.json"
}
},
"required": ["name", "type"]
}