tibi-types/schemas/api-config/field.json

86 lines
2.6 KiB
JSON
Raw Normal View History

2022-02-01 18:59:17 +01:00
{
"$schema": "http://json-schema.org/draft-07/schema#",
2022-02-26 10:43:52 +01:00
"title": "JSON Schema tibi-server field configuration",
"description": "tibi-server field linter",
2022-02-01 18:59:17 +01:00
"type": "object",
"additionalProperties": false,
2022-10-12 16:23:32 +02:00
"patternProperties": {
"^x\\-": {
"description": "template property"
}
},
2022-02-01 18:59:17 +01:00
"properties": {
"name": {
"type": "string",
"description": "name of field",
"pattern": "^[0-9a-zA-Z_]+$"
},
"type": {
"enum": [
"string",
"string[]",
"number",
"number[]",
"boolean",
"object",
"object[]",
2022-02-02 13:30:50 +01:00
"file",
2022-04-22 16:29:30 +02:00
"date",
2022-02-01 18:59:17 +01:00
"any"
]
},
"index": {
"type": "array",
"items": {
"enum": ["single", "unique", "text"]
}
},
"subFields": {
2022-08-16 11:00:25 +02:00
"oneOf": [
{
"$comment": "for include tag",
"type": "string"
},
{
"type": "array",
"description": "sub fields of object",
"items": {
"oneOf": [
{
"$comment": "for include tag",
"type": "string"
},
{
"$ref": "#"
}
]
2022-02-02 13:30:50 +01:00
}
2022-08-16 11:00:25 +02:00
}
]
2022-02-01 18:59:17 +01:00
},
2022-10-27 15:58:18 +02:00
"validator": {
"type": "object",
"description": "field validator",
2022-10-27 16:48:27 +02:00
"additionalProperties": false,
2022-10-27 15:58:18 +02:00
"properties": {
2022-10-27 16:48:27 +02:00
"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"
},
2022-10-27 15:58:18 +02:00
"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"
}
}
},
2022-02-01 18:59:17 +01:00
"meta": {
"$ref": "fieldMeta.json"
2022-02-01 18:59:17 +01:00
}
},
"required": ["name", "type"]
2022-02-01 18:59:17 +01:00
}