Objects
Objects can contain any properties. A property is described under Properties and can be refined through optional metadata (propertiesMeta).
The following JSON schema describes an object with two properties.
{
"$schema": "http://json-schema.org/draft-04/schema",
"definitions": {
"CustomDatatype": {
"$schema": "http://json-schema.org/draft-04/schema",
"title": "CustomDatatype",
"type": "object",
"propertiesMeta": [
{
"name": "axisName",
"category": "Name",
"displayName": "Axis Name",
"displayPriority": 10,
"description": "",
"defaultValue": null,
"defaultValueInternal": null
},
{
"name": "axisColor",
"category": "Colors",
"displayName": "Axis color",
"displayPriority": 10,
"description": "",
"defaultValue": null,
"defaultValueInternal": {
"color": "#4794da"
}
}
],
"properties": {
"axisName": {
"type": "string"
},
"axisColor": {
"$ref": "tchmi:framework#/definitions/SolidColor"
}
},
"required": [ "axisName" ]
}
}
}
This results in the following generic data editor in Engineering.
Explanations
propertiesMeta:
The metadata of the properties are optional. They describe the display within the generic data editor. The metadata are described by the following properties:
name
{String}: Internal name of the property, see "name" in Description.json.
Info: The name must match the name under the properties.category
{String}: Name of the category under which the property is displayed in the generic data editor, see "category" in Description.json.displayName
{String}: Name of the property displayed in the generic data editor, see "displayName" in Description.json.displayPriority
{Number}: Priority of the display, see "displayPriority" in Description.json.description
{String}: Description of the property, see "description" in Description.json.defaultValue
: Default value used initially in engineering, see "defaultValue" in Description.json.defaultValueInternal
: Internal default value, see "defaultValueInternal" in Description.json.
properties:
The name and data type of the object properties are described under Properties. The name is determined by the name of the property. The data type can be described as follows:
type
{String}: Default JSON data type of the property, or$ref
{String, reference}: Reference to a framework data type. This can be implemented within the project or taken from the existing data type descriptions of the framework.
required:
The required properties are listed under "required". The list is based on the internal name. If a property of the object that is set to required is not set in Engineering, the generic data editor displays a warning.