updated schema for contentbuilder and refactored code
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-18 18:59:36 +00:00
parent dcfde495c7
commit 14da32bac6
7 changed files with 521 additions and 235 deletions

View File

@@ -78,227 +78,8 @@
}
},
"meta": {
"type": "object",
"description": "meta object of field",
"properties": {
"label": {
"$ref": "#/definitions/i18nString"
},
"helperText": {
"$ref": "#/definitions/i18nString"
},
"widget": {
"description": "ui widget",
"enum": [
"text",
"richText",
"checkbox",
"checkboxArray",
"select",
"selectArray",
"date",
"datetime",
"file",
"image",
"json",
"tabs"
]
},
"choices": {
"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"
}
]
},
"name": {
"description": "name is human readable value",
"$ref": "#/definitions/i18nString"
},
"chipStyle": {
"$ref": "https://raw.githubusercontent.com/rcorp/css-schema/master/schema.json"
}
},
"required": ["id", "name"]
}
}
]
},
"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"
}
}
}
]
}
}
},
"dependsOn": {
"description": "depends on rule",
"oneOf": [
{ "type": "string" },
{
"type": "object",
"properties": {
"eval": {
"type": "string",
"description": "javascript code which hides field widget if evaluates to false with $, $this, $parent and $stack variables"
}
}
}
]
},
"defaultValue": {
"description": "default value or code to get the value",
"oneOf": [
{ "type": "array" },
{ "type": "string" },
{ "type": "null" },
{ "type": "boolean" },
{ "type": "number" },
{
"type": "object",
"properties": {
"eval": {
"type": "string",
"description": "js code with $navigation variable"
}
}
}
]
}
}
"$ref": "fieldMeta.json"
}
},
"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_]+)*$"
}
}
"required": ["name", "type"]
}