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" : {
"type" : "object" ,
"description" : "meta object of field" ,
"properties" : {
"label" : {
"$ref" : "#/definitions/i18nString"
} ,
"helperText" : {
"$ref" : "#/definitions/i18nString"
} ,
"widget" : {
"description" : "ui widget" ,
"enum" : [
"richtext" ,
"richText" ,
"html" ,
"checkbox" ,
2022-10-12 16:12:24 +02:00
"checkboxArray" ,
2022-02-01 18:59:17 +01:00
"select" ,
"selectArray" ,
"date" ,
2022-10-27 15:58:18 +02:00
"datetime" ,
2022-02-01 18:59:17 +01:00
"file" ,
2022-08-16 10:24:45 +02:00
"image" ,
2022-10-13 13:50:37 +02:00
"jsonField" ,
"tabs"
2022-02-01 18:59:17 +01:00
]
} ,
"choices" : {
2022-10-12 16:46:04 +02:00
"oneOf" : [
{
"type" : "object" ,
"description" : "endpoint configuration" ,
"additionalProperties" : false ,
"properties" : {
"endpoint" : {
"type" : "string" ,
"description" : "endpoint URL or path"
} ,
"params" : {
"type" : "object" ,
"description" : "query parameters"
} ,
"mapping" : {
"type" : "object" ,
"description" : "data mapping" ,
"additionalProperties" : false ,
"properties" : {
"id" : {
"type" : "string" ,
"description" : "name of id field"
} ,
"name" : {
"type" : "string" ,
"description" : "name of name/description field"
}
}
}
}
} ,
{
"type" : "array" ,
"description" : "choices to select from" ,
"items" : {
"type" : "object" ,
"properties" : {
"id" : {
"oneOf" : [
{
"type" : "null"
} ,
{
"type" : "string"
} ,
{
"type" : "number"
}
]
2022-08-16 11:07:52 +02:00
} ,
2022-10-12 16:46:04 +02:00
"name" : {
"description" : "name is human readable value" ,
"$ref" : "#/definitions/i18nString"
2022-08-16 11:07:52 +02:00
} ,
2022-10-12 16:46:04 +02:00
"chipStyle" : {
"$ref" : "https://raw.githubusercontent.com/rcorp/css-schema/master/schema.json"
2022-08-16 11:07:52 +02:00
}
2022-10-12 16:46:04 +02:00
} ,
"required" : [ "id" , "name" ]
2022-02-01 18:59:17 +01:00
}
2022-10-12 16:46:04 +02:00
}
]
2022-02-01 18:59:17 +01:00
} ,
"valueMap" : {
"type" : "object" ,
"description" : "map values to icons" ,
"patternProperties" : {
".*" : {
"oneOf" : [
{
"type" : "string"
} ,
{
"type" : "object" ,
"properties" : {
"muiIcon" : {
"type" : "string"
} ,
"style" : {
"$ref" : "https://raw.githubusercontent.com/rcorp/css-schema/master/schema.json"
}
}
}
]
}
}
2022-10-18 16:48:16 +02:00
} ,
"dependsOn" : {
"description" : "depends on rule" ,
"oneOf" : [
{ "type" : "string" } ,
{
"type" : "object" ,
"properties" : {
"eval" : {
"type" : "string" ,
2022-10-27 15:58:18 +02:00
"description" : "javascript code which hides field widget if evaluates to false with $, $this, $parent and $stack variables"
2022-10-18 16:48:16 +02:00
}
}
}
]
} ,
"defaultValue" : {
"description" : "default value or code to get the value" ,
"oneOf" : [
2022-10-18 16:52:02 +02:00
{ "type" : "array" } ,
2022-10-18 16:48:16 +02:00
{ "type" : "string" } ,
2022-10-18 16:52:02 +02:00
{ "type" : "null" } ,
{ "type" : "boolean" } ,
{ "type" : "number" } ,
2022-10-18 16:48:16 +02:00
{
"type" : "object" ,
"properties" : {
"eval" : {
"type" : "string" ,
"description" : "js code with $navigation variable"
}
}
}
]
2022-02-01 18:59:17 +01:00
}
}
}
} ,
"required" : [ "name" , "type" ] ,
"definitions" : {
"i18nString" : {
"oneOf" : [
{
"type" : "object" ,
"patternProperties" : {
"^[a-z]$" : {
"type" : "string"
}
}
} ,
{
"type" : "string"
}
]
} ,
"evalExpressions" : {
"oneOf" : [
{
"type" : "object" ,
"additionalProperties" : true ,
"properties" : {
"twig" : {
"type" : "string" ,
"description" : "twig template"
} ,
"projection" : {
"type" : "string" ,
"description" : "query projection to use"
}
} ,
"required" : [ "twig" ]
} ,
{
"type" : "object" ,
"additionalProperties" : true ,
"properties" : {
"eval" : {
"type" : "string" ,
"description" : "javascript code"
} ,
"projection" : {
"type" : "string" ,
"description" : "query projection to use"
}
} ,
"required" : [ "eval" ]
}
]
} ,
"fieldSource" : {
"oneOf" : [
{
"$ref" : "#/definitions/fieldPath"
} ,
{
"type" : "object" ,
"properties" : {
"source" : {
"$ref" : "#/definitions/fieldPath"
}
}
}
]
} ,
"fieldPath" : {
"type" : "string" ,
"description" : "field, sub fields separated with dot (.)" ,
"pattern" : "^[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*$"
}
}
}