This commit is contained in:
194
schemas/api-config/field.json
Normal file
194
schemas/api-config/field.json
Normal file
@@ -0,0 +1,194 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "JSON Schema WMBasic field configuration",
|
||||
"description": "WMBasic field linter",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "name of field",
|
||||
"pattern": "^[0-9a-zA-Z_]+$"
|
||||
},
|
||||
"type": {
|
||||
"enum": [
|
||||
"string",
|
||||
"string[]",
|
||||
"number",
|
||||
"number[]",
|
||||
"boolean",
|
||||
"object",
|
||||
"object[]",
|
||||
"any"
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"enum": ["single", "unique", "text"]
|
||||
}
|
||||
},
|
||||
"subFields": {
|
||||
"type": "array",
|
||||
"description": "sub fields of object",
|
||||
"items": {
|
||||
"$ref": "#"
|
||||
}
|
||||
},
|
||||
"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",
|
||||
"select",
|
||||
"selectArray",
|
||||
"date",
|
||||
"file",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
"choices": {
|
||||
"type": "array",
|
||||
"description": "choices to select from",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is human readable value",
|
||||
"$ref": "#/definitions/i18nString"
|
||||
},
|
||||
"chipStyle": {
|
||||
"$ref": "https://raw.githubusercontent.com/rcorp/css-schema/master/schema.json"
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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_]+)*$"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user