Skip to content

JSON Schema


Abstract

JSON Schema is a specification for JSON based format for defining the structure of JSON data. JSON Schema uses the JSON syntax and defines keys with vocabulary that allows you to annotate and validate JSON documents.


In the context of the SEAL Print Client JSON schema is per connector embedded in panel configuration as well as server settings configuration to define the data structure of the panel settings area and the according server settings respectively. The client uses the data structure definition for both, displaying GUI elements for user input and validating that user input before sending data to server.


Data Structure

Example - Example of a panel configuration file

{
  "name": "PLOSSYS 4",
  "type": "print",
  "pid": "f75bf1b0-6920-41cb-9fc8-a88191710f41",
  "json_schema": {
    "$schema": "http://json-schema.org/schema#",
    "type": "object",
    "required": ["Copies"],
    "properties": {
      "Copies": {
        "type": "number",
        "description": "Copies",
        "minimum": 1,
        "default": 1
      },
    },
  },
  "fieldsets": [
    {
      "fields": [
        "Copies"
      ]
    }
  ]
}

name

name specifies the name of the panel shown in the SEAL Print Client user interface.

The value can be modified according to your specific needs.


type (Data Structure)

type specifies the type of the panel.

The value must not be modified.


pid

pid specifies the unique panel id.

The value must not be modified.


json_schema

json_schema is the schema definition for the settings area of the panel. See sections JSON schema keys and Data Types below.

The value can be modified according to your specific needs.


fieldsets

fieldsets specifies the JSON schema properties displayed and arranged together in the SEAL Print Client User Interface. Each data element defined in json_schema/properties has to be listed here.


JSON Schema Keys


$schema

$schema refers to the used JSON schema, value is always http://json-schema.org/schema#.

The value must not be modified.


type (JSON Schema Key)

type specifies the type of the top level JSON schema element, the value is always object.

The value must not be modified.


required

required specifies a JSON array with the names of alls JSON schema properties which at least have to be filled in by user.

The value can be modified according to your specific needs.


properties

properties specifies all JSON schema data elements. Each property is an object composed of an arbitrary name like Copies or PLS_FLAGPAGE, which is used as the key for storing the user entered value on server side and set of key/value pairs describing the data element. Each JSON schema property consists of a mandatory type and some optional parameters like description or widget for defining a GUI element. The available parameters depend on the data type.

Some common used properties are mapped by the connectors for the backend systems. Mappings of the PLOSSYS 4 connector are:

Operator Property PLOSSYS 4 Header
Printer PLS_PLOTTER
Color PLS_PLOTPEN
Format PLS_PLOTSIZE
Copies PLS_PLOTCOPY
Duplex PLS_DUPLEX
Quality PLS_PRINT_QUALITY
rotationAngle PLS_PLOT_ROTATE
name PLS_ORIG_NAME

Data Types


boolean

Data type boolean defines a bollean true/false value. The default and only available GUI widget is checkbox. Optional description and default keys are available.

The PLOSSYS 4 connector converts all boolean values automatically to Y and N.

Example - data type boolean

"PLS_FLAGPAGE": {
  "type": "boolean",
  "widget": "checkbox",
  "description": "Flagpage",
  "default": true
}

string

Data type string defines a UTF-8 encoded character sequence. The default GUI widget is string which is a free editable text field. Additionally available is password for hidden entries and toogle and select in case of an enumeration is defined. Optional description, default and visibleIf keys are available.

Example - data type string

"MyPassword": {
  "type": "string",
  "widget": "password",
  "description": "MY PASSWORD",
  "default": ""
}

number

Data type number defines a numerical value. The default GUI widget is number which is an edit field with stepper arrows. Additionally available is password for hidden entries like PIN numbers. Optional description, default, minimum, maximum, multipleOf and visibleIf keys are available.

Example - data type number

"Rotation": {
  "type": "number",
  "description": "Rotation",
  "default": 0,
  "minimum": 0,
  "maximum": 270,
  "multipleOf": 90
}

object

Data type object defines a comples object type composed of properties which could on theirs part objects again. The only available GUI widget is hidden which doesn't show anything at all. This data type is only used for managing visibility of GUI elements dynamically by a printer capabilities object returned from server for the currently selected printer.

Example - data type object

```json "Capabilities": { "type": "object", "widget": "hidden", "properties": { "Duplex": { "type": "boolean", "default": true } } } ´´´

This defined boolean value could be referenced by another property via the visibleIf key:

"MySpecialDuplex": {
 "type": "string",
 "description": "Special duplex value",
 "visibleIf": {
   "Capabilities/Duplex": [
      true
   ]
 }

enumeration

An enumeration is a collection of values of one of the above described basic data types. Available widgets are toggle and select. There is currently no way defining a default value for an enumeration. The enumeration values are defined in a list specified by the keyword oneOf. Each one is an unnamed object composed of the internal enum value to store and a description displayed for user in the user interface.

Example - data type enumeration

  "Quality": {
    "type": "string",
    "description": "Print Quality",
    "widget": "select",
    "oneOf": [
      {
        "enum": [
          "LOW"
        ],
        "description": "Low"
      },
      {
        "enum": [
          "NORMAL"
        ],
        "description": "Normal"
      },
      {
        "enum": [
          "HIGH"
        ],
        "description": "High"
      }
    ]
  }

Back to top