UNPKG

@bpmn-io/form-json-schema

Version:

JSON Schema for form-js

1,581 lines 48.9 kB
{ "$schema": "http://json-schema.org/draft-07/schema", "$id": "http://niklaskiefer.de/schema/form-js/1.0", "title": "form-js JSON Schema", "type": "object", "allOf": [ { "$schema": "http://json-schema.org/draft-07/schema", "allOf": [ { "if": { "properties": { "type": { "const": "default" } }, "required": [ "type" ] }, "then": { "properties": { "layout": false, "conditional": false, "properties": false } } } ] } ], "properties": { "type": { "$id": "#/type", "description": "The type of a form.", "type": "string", "const": "default" }, "id": { "$id": "#/id", "description": "The id of a form.", "type": "string" }, "schemaVersion": { "$id": "#/schemaVersion", "description": "The schema version of a form", "type": "integer", "minimum": 1, "maximum": 19 }, "executionPlatform": { "$id": "#/executionPlatform", "description": "The target execution platform of a form", "type": "string" }, "executionPlatformVersion": { "$id": "#/executionPlatformVersion", "description": "The target execution platform version of a form", "type": "string" }, "versionTag": { "$id": "#/versionTag", "description": "The version tag of a form", "type": "string" }, "exporter": { "$id": "#/exporter", "$schema": "http://json-schema.org/draft-07/schema", "description": "The exporter tool of a form", "type": "object", "properties": { "name": { "$id": "#/exporter/name", "description": "The name of the exporter tool", "type": "string" }, "version": { "$id": "#/exporter/version", "description": "The version of the exporter tool", "type": "string" } } }, "components": { "type": "array", "$id": "#/components", "description": "List of form fields.", "items": { "type": "object", "$id": "#/component", "$schema": "http://json-schema.org/draft-07/schema", "allOf": [ { "$schema": "http://json-schema.org/draft-07/schema", "allOf": [ { "if": { "properties": { "type": { "enum": [ "checkbox", "checklist", "datetime", "number", "radio", "select", "taglist", "textfield", "textarea", "expression", "filepicker" ] } }, "required": [ "type" ] }, "then": { "required": [ "key" ] } }, { "if": { "properties": { "type": { "const": "table" } }, "required": [ "type" ] }, "then": { "oneOf": [ { "required": [ "dataSource", "columns" ] }, { "required": [ "dataSource", "columnsExpression" ] } ] } }, { "if": { "properties": { "type": { "enum": [ "table", "documentPreview" ] } }, "required": [ "type" ] }, "then": { "required": [ "dataSource" ] } }, { "if": { "properties": { "type": { "const": "expression" } }, "required": [ "type" ] }, "then": { "required": [ "expression", "computeOn" ] } } ] }, { "$schema": "http://json-schema.org/draft-07/schema", "allOf": [ { "if": { "not": { "properties": { "type": { "const": "text" } }, "required": [ "type" ] } }, "then": { "properties": { "text": false } } }, { "if": { "not": { "anyOf": [ { "$ref": "#/properties/components/items/allOf/0/allOf/0/if" }, { "properties": { "type": { "enum": [ "button", "iframe" ] } }, "required": [ "type" ] }, { "$ref": "#/properties/components/items/allOf/1/allOf/14/if/not" }, { "$ref": "#/properties/components/items/allOf/0/allOf/2/if" } ] } }, "then": { "properties": { "label": false } } }, { "if": { "not": { "$ref": "#/properties/components/items/allOf/0/allOf/0/if" } }, "then": { "properties": { "description": false, "disabled": false, "readonly": false, "validate": false } } }, { "if": { "not": { "properties": { "type": { "const": "button" } }, "required": [ "type" ] } }, "then": { "properties": { "action": false } } }, { "if": { "not": { "properties": { "type": { "const": "image" } }, "required": [ "type" ] } }, "then": { "properties": { "source": false, "alt": false } } }, { "if": { "not": { "properties": { "type": { "const": "datetime" } }, "required": [ "type" ] } }, "then": { "properties": { "subtype": false, "dateLabel": false, "timeLabel": false, "use24h": false, "timeSerializingFormat": false, "timeInterval": false, "disallowPassedDates": false } } }, { "if": { "not": { "properties": { "type": { "const": "number" } }, "required": [ "type" ] } }, "then": { "properties": { "increment": false, "decimalDigits": false, "serializeToString": false, "validate": { "properties": { "min": false, "max": false } } } } }, { "if": { "not": { "properties": { "type": { "const": "select" } }, "required": [ "type" ] } }, "then": { "properties": { "searchable": false } } }, { "if": { "not": { "properties": { "type": { "enum": [ "checklist", "radio", "select", "taglist" ] } }, "required": [ "type" ] } }, "then": { "properties": { "values": false, "valuesKey": false, "valuesExpression": false } } }, { "if": { "not": { "properties": { "type": { "const": "textfield" } }, "required": [ "type" ] } }, "then": { "properties": { "validate": { "properties": { "validationType": false, "pattern": false } } } } }, { "if": { "not": { "properties": { "type": { "enum": [ "textfield", "textarea" ] } }, "required": [ "type" ] } }, "then": { "properties": { "validate": { "properties": { "minLength": false, "maxLength": false } } } } }, { "if": { "not": { "properties": { "type": { "enum": [ "textfield", "number" ] } }, "required": [ "type" ] } }, "then": { "properties": { "appearance": { "properties": { "prefixAdorner": false, "suffixAdorner": false } } } } }, { "if": { "anyOf": [ { "not": { "$ref": "#/properties/components/items/allOf/0/allOf/0/if" } }, { "allOf": [ { "$ref": "#/properties/components/items/allOf/1/allOf/8/if/not" }, { "properties": { "valuesKey": { "type": "string" } }, "required": [ "valuesKey" ] } ] } ] }, "then": { "properties": { "defaultValue": false } } }, { "if": { "not": { "properties": { "type": { "enum": [ "spacer", "iframe" ] } }, "required": [ "type" ] } }, "then": { "properties": { "height": false } } }, { "if": { "not": { "properties": { "type": { "enum": [ "group", "dynamiclist" ] } }, "required": [ "type" ] } }, "then": { "properties": { "path": false, "showOutline": false, "verticalAlignment": false, "components": false } } }, { "if": { "not": { "properties": { "type": { "const": "dynamiclist" } }, "required": [ "type" ] } }, "then": { "properties": { "isRepeating": false, "defaultRepetitions": false, "allowAddRemove": false, "disableCollapse": false, "nonCollapsedItems": false } } }, { "if": { "not": { "$ref": "#/properties/components/items/allOf/0/allOf/0/if" } }, "then": { "properties": { "key": false } } }, { "if": { "not": { "properties": { "type": { "const": "table" } }, "required": [ "type" ] } }, "then": { "properties": { "columns": false, "columnsExpression": false, "rowCount": false } } }, { "if": { "properties": { "type": { "const": "table" } }, "required": [ "type" ] }, "then": { "oneOf": [ { "properties": { "columns": true, "rowCount": true, "columnsExpression": false, "dataSource": true }, "errorMessage": "Invalid combination of properties. 'columns' and 'columnsExpression' should not exist together." }, { "properties": { "columns": false, "rowCount": true, "columnsExpression": true, "dataSource": true }, "errorMessage": "Invalid combination of properties. 'columns' and 'columnsExpression' not should exist together." } ] } }, { "if": { "not": { "$ref": "#/properties/components/items/allOf/0/allOf/2/if" } }, "then": { "properties": { "dataSource": false } } }, { "if": { "not": { "properties": { "type": { "const": "html" } }, "required": [ "type" ] } }, "then": { "properties": { "content": false } } }, { "if": { "not": { "properties": { "type": { "const": "filepicker" } }, "required": [ "type" ] } }, "then": { "properties": { "accept": false, "multiple": false } } }, { "if": { "properties": { "type": { "const": "filepicker" } }, "required": [ "type" ] }, "then": { "properties": { "description": false } } }, { "if": { "not": { "properties": { "type": { "const": "documentPreview" } }, "required": [ "type" ] } }, "then": { "properties": { "maxHeight": false } } }, { "if": { "not": { "properties": { "type": { "const": "textfield" } }, "required": [ "type" ] } }, "then": { "properties": { "validate": { "properties": { "patternErrorMessage": false } } } } }, { "if": { "properties": { "validate": { "required": [ "patternErrorMessage" ] } } }, "then": { "properties": { "validate": { "required": [ "pattern" ] } } } } ] }, { "$schema": "http://json-schema.org/draft-07/schema", "allOf": [ { "if": { "properties": { "type": { "const": "checkbox" } }, "required": [ "type" ] }, "then": { "properties": { "defaultValue": { "type": "boolean" } } } }, { "if": { "properties": { "type": { "enum": [ "textfield", "textarea", "datetime", "radio", "select" ] } }, "required": [ "type" ] }, "then": { "properties": { "defaultValue": { "type": "string" } } } }, { "if": { "properties": { "type": { "const": "number" } }, "required": [ "type" ] }, "then": { "properties": { "defaultValue": { "type": [ "number", "string" ] } } } }, { "if": { "properties": { "type": { "enum": [ "checklist", "taglist" ] } }, "required": [ "type" ] }, "then": { "properties": { "defaultValue": { "type": "array" } } } } ] } ], "properties": { "type": { "$id": "#/component/type", "$schema": "http://json-schema.org/draft-07/schema", "description": "The type of a form field.", "enum": [ "textfield", "number", "datetime", "textarea", "checkbox", "radio", "select", "checklist", "taglist", "image", "text", "html", "button", "spacer", "group", "dynamiclist", "separator", "table", "iframe", "expression", "filepicker", "documentPreview" ] }, "id": { "$id": "#/component/id", "description": "The id of a form field.", "type": "string" }, "label": { "$id": "#/component/label", "description": "Label displayed on top of the form field.", "type": "string" }, "description": { "$id": "#/component/description", "description": "Description provided below the form field.", "type": "string" }, "key": { "$id": "#/component/key", "description": "Binds the form field to a form variable. Can be a dot separated path.", "type": "string", "pattern": "^\\w+(\\.\\w+)*$" }, "readonly": { "$id": "#/component/readonly", "description": "Makes the form field read only.", "type": [ "boolean", "string" ] }, "disabled": { "$id": "#/component/disabled", "description": "Disables the form field.", "type": [ "boolean", "string" ] }, "text": { "$id": "#/component/text", "description": "Text content of a text view. Either an expression, plain text, or templating syntax.", "type": "string" }, "defaultValue": { "$id": "#/component/defaultValue", "description": "Provides a default value for the form field in case no input data exists for the given key.", "type": [ "string", "boolean", "number", "array" ] }, "action": { "$id": "#/component/action", "description": "A button can either trigger a submit or a reset action. Defaults to submit.", "default": "submit", "type": "string", "enum": [ "submit", "reset" ] }, "source": { "$id": "#/component/source", "description": "Specifies the image source via expression or static value (hyperlink or data URI).", "type": "string" }, "alt": { "$id": "#/component/alt", "description": "Provides an alternative text to the image in case it cannot be displayed.", "type": "string" }, "url": { "$id": "#/component/url", "description": "Enter a URL to an external source.", "type": "string" }, "subtype": { "$id": "#/component/subtype", "description": "Selects the type of the datetime component. This can either be date, time, or datetime. Defaults to date.", "type": "string", "default": "date", "enum": [ "date", "time", "datetime" ] }, "dateLabel": { "$id": "#/component/dateLabel", "description": "Label displayed beside the date input field.", "type": "string" }, "timeLabel": { "$id": "#/component/timeLabel", "description": "Label displayed beside the time input field.", "type": "string" }, "use24h": { "$id": "#/component/use24h", "description": "Enables 24-hour time format.", "type": "boolean" }, "timeSerializingFormat": { "$id": "#/component/timeSerializingFormat", "description": "Defines the time data format. This can either be utc_offset, utc_normalized, or no_timezone.", "type": "string", "enum": [ "utc_offset", "utc_normalized", "no_timezone" ] }, "timeInterval": { "$id": "#/component/timeInterval", "description": "Defines the steps of time that can be selected in the time input field.", "type": "integer", "minimum": 1, "maximum": 60 }, "disallowPassedDates": { "$id": "#/component/disallowPassedDates", "description": "Enables the restriction to not allow past dates.", "type": "boolean" }, "increment": { "$id": "#/component/increment", "description": "Defines the increment between valid field value.", "type": [ "number", "string" ] }, "decimalDigits": { "$id": "#/component/decimalDigits", "description": "Defines the maximum number of digits after the decimal..", "type": "integer" }, "serializeToString": { "$id": "#/component/serializeToString", "description": "Configures the output format of the value. This enables unlimited precision digits.", "type": "boolean" }, "searchable": { "$id": "#/component/searchable", "description": "Allows the select entries to be searched via keyboard.", "type": "boolean" }, "valuesKey": { "$id": "#/component/valuesKey", "description": "Form fields can be configured with an options source defining the individual choices the select provides.", "type": "string", "pattern": "^[^\\s]*$" }, "valuesExpression": { "$id": "#/component/valuesExpression", "description": "Form fields can be configured with a FEEL expression defining the individual choices the select provides.", "type": "string" }, "height": { "$id": "#/component/height", "description": "The height of a form component.", "type": "number" }, "components": { "type": "array", "$id": "#/component/components", "description": "List of form field children.", "items": { "type": "object", "$ref": "#/properties/components/items", "$id": "#/components/component" } }, "path": { "$id": "#/component/path", "description": "Assigns a path that maps form field children into a data object. Can be a dot separated path.", "type": "string", "pattern": "^(\\w+(\\.\\w+)*)*$" }, "showOutline": { "$id": "#/component/showOutline", "description": "Outlines groups and dynamic lists.", "type": "boolean" }, "verticalAlignment": { "$id": "#/component/verticalAlignment", "description": "Sets the alignment of the form field children. This can either be start, center, or end. Defaults to start.", "type": "string", "default": "start", "enum": [ "start", "center", "end" ] }, "isRepeating": { "$id": "#/component/isRepeating", "description": "Defines whether the list should currently be repeating its children.", "type": "boolean" }, "allowAddRemove": { "$id": "#/component/allowAddRemove", "description": "Allow adding and removing items from a list.", "type": "boolean" }, "defaultRepetitions": { "$id": "#/component/defaultRepetitions", "description": "Default number of repetitions a dynamic list will render with, if no data is provided. Defaults to 1.", "type": "number" }, "disableCollapse": { "$id": "#/component/disableCollapse", "description": "Disable the ability of a list can be collapsed.", "type": "boolean" }, "nonCollapsedItems": { "$id": "#/component/nonCollapsedItems", "description": "Number of items that will be rendered when a list is collapsed. Defaults to 5.", "type": "number" }, "validate": { "$id": "#/component/validate", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "description": "Given that one of the following properties is set, the form will only submit when the respective condition is fulfilled. Otherwise, a validation error will be displayed.", "properties": { "required": { "$id": "/#component/validate/required", "type": "boolean", "description": "Form field must contain a value." }, "validationType": { "$id": "/#component/validate/validationType", "type": "string", "description": "Use predefined validation patterns. Available options are: Email, Phone, and Custom (empty).", "enum": [ "email", "phone", "custom", "", null ] }, "pattern": { "$id": "/#component/validate/pattern", "type": "string", "description": "Form field value must match the provided RegEx pattern." }, "minLength": { "$id": "/#component/validate/minLength", "type": [ "integer", "string" ], "description": "Form field value must be at least the provided length." }, "maxLength": { "$id": "/#component/validate/maxLength", "type": [ "integer", "string" ], "description": "Form field value must be at most the provided length." }, "min": { "$id": "/#component/validate/min", "type": [ "number", "string" ], "description": "Form field value must be at least the provided number." }, "max": { "$id": "/#component/validate/max", "type": [ "number", "string" ], "description": "Form field value must be at most the provided number." }, "patternErrorMessage": { "$id": "/#component/validate/patternErrorMessage", "type": "string", "description": "The error message to display when the input does not match the regular expression." } } }, "layout": { "$id": "#/component/layout", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "description": "Layout related information of a form field.", "properties": { "row": { "$id": "/#component/layout/row", "type": [ "string", "null" ], "description": "Row in which a form field is placed." }, "columns": { "$id": "/#component/layout/columns", "type": [ "integer", "null" ], "description": "Space the field will use inside its row. No value means it will automatically adjust to available space in the row.", "minimum": 2, "maximum": 16 } } }, "values": { "$id": "#/component/values", "$schema": "http://json-schema.org/draft-07/schema", "type": "array", "description": "Static options of a form field", "items": { "type": "object", "properties": { "label": { "$id": "#/component/values/label", "type": "string", "description": "Label of the option" }, "value": { "$id": "#/component/values/value", "type": "string", "description": "Value of the option" } } } }, "appearance": { "$id": "#/component/appearance", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "description": "Changes the visual appearance of the form field.", "properties": { "prefixAdorner": { "$id": "/#component/appearance/prefixAdorner", "type": "string", "description": "Adds an appendage before the input." }, "suffixAdorner": { "$id": "/#component/appearance/suffixAdorner", "type": "string", "description": "Adds an appendage after the input." } } }, "conditional": { "$id": "#/component/conditional", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "description": "Information of a form field related to conditional rendering.", "properties": { "hide": { "$id": "/#component/conditional/hide", "type": [ "string", "boolean" ], "description": "Expression to hide the form field." } } }, "properties": { "$id": "#/component/properties", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "description": "Custom properties of a form field." }, "columns": { "$id": "#/component/columns", "$schema": "http://json-schema.org/draft-07/schema", "type": "array", "description": "Columns of a table component", "items": { "type": "object", "properties": { "label": { "$id": "#/component/columns/label", "type": "string", "description": "Label of the column" }, "key": { "$id": "#/component/values/key", "type": "string", "description": "Key of the column" } } } }, "columnsExpression": { "$id": "#/component/columnsExpression", "description": "Table columns can be configured with a FEEL expression defining the individual columns the table will render.", "type": "string" }, "rowCount": { "$id": "#/component/rowCount", "description": "Define the amount of rows a table will render.", "type": "number", "default": 10 }, "dataSource": { "$id": "#/component/dataSource", "description": "Specifies the data source which will populate the table or the document preview components.", "type": "string" }, "security": { "$id": "#/component/security", "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "description": "Security related information of a form field.", "properties": { "allowSameOrigin": { "$id": "/#component/security/allowSameOrigin", "type": "boolean", "description": "Allows the iframe content to be treated as being from the same origin." }, "fullscreen": { "$id": "/#component/security/fullscreen", "type": "boolean", "description": "Specifies the permissions policy set for the fullscreen directive." }, "geolocation": { "$id": "/#component/security/geolocation", "type": "boolean", "description": "Specifies the permissions policy set for the geolocation directive." }, "camera": { "$id": "/#component/security/camera", "type": "boolean", "description": "Specifies the permissions policy set for the camera directive." }, "microphone": { "$id": "/#component/security/microphone", "type": "boolean", "description": "Specifies the permissions policy set for the microphone directive." }, "allowForms": { "$id": "/#component/security/allowForms", "type": "boolean", "description": "Allows form submission." }, "allowModals": { "$id": "/#component/security/allowModals", "type": "boolean", "description": "Allows to open modal windows." }, "allowPopups": { "$id": "/#component/security/allowPopups", "type": "boolean", "description": "Allows to open popups." }, "allowTopNavigation": { "$id": "/#component/security/allowTopNavigation", "type": "boolean", "description": "Allows the iframe content to navigate its top-level browsing context." } } }, "content": { "$id": "#/component/content", "description": "The content of a custom component.", "type": "string" }, "accept": { "$id": "#/component/accept", "description": "Define the accepted file types.", "type": "string" }, "multiple": { "$id": "#/component/multiple", "description": "Allow multiple files to be selected.", "type": [ "boolean", "string" ] }, "maxHeight": { "$id": "#/component/maxHeight", "description": "The maximum height of a document item in the document preview component.", "type": "number" } }, "required": [ "type" ] }, "allOf": [ { "examples": [ [ { "text": "Create a text", "type": "text" } ], [ { "type": "expression", "expression": "=1 + 1", "computeOn": "change", "key": "expression" } ], [ { "content": "<h1>HTML</h1>", "type": "html" } ], [ { "label": "Create a text field", "type": "textfield", "key": "textfield" } ], [ { "label": "Create a number field", "type": "number", "key": "number" } ], [ { "label": "Create a check box", "type": "checkbox", "key": "checkbox" } ], [ { "label": "Create a check list", "values": [ { "label": "Option 1", "value": "option_1" }, { "label": "Option 2", "value": "option_2" } ], "type": "checklist", "key": "checklist" } ], [ { "label": "Create a tag list", "values": [ { "label": "Option 1", "value": "option_1" }, { "label": "Option 2", "value": "option_2" } ], "type": "taglist", "key": "taglist" } ], [ { "label": "Create a radio button", "values": [ { "label": "Option 1", "value": "option_1" }, { "label": "Option 2", "value": "option_2" } ], "type": "radio", "key": "radio" } ], [ { "label": "Create a select", "values": [ { "label": "Option 1", "value": "option_1" }, { "label": "Option 2", "value": "option_2" } ], "type": "select", "key": "select" } ], [ { "alt": "Create an image", "type": "image" } ], [ { "label": "Create a text area", "type": "textarea", "key": "textarea" } ], [ { "dateLabel": "Create a date time picker", "subtype": "date", "type": "datetime", "key": "date" } ], [ { "type": "spacer", "height": 60 } ], [ { "label": "Create a button", "type": "button", "action": "submit" } ], [ { "label": "Create a group", "type": "group", "components": [] } ], [ { "label": "Create a dynamic list", "type": "dymamiclist", "components": [] } ], [ { "label": "Create an iframe", "type": "iframe", "url": "https://bpmn.io" } ], [ { "label": "Create a dynamic table", "type": "table", "rowCount": 10 } ] ] } ] } }, "required": [ "type", "components" ] }