Skip to content

JSON Form

JSON Schema is used for rendering forms from providers and tasks in the frontend.

Example of JSON Form:

{
  "$id": "https://neops.io/schema/example.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Demo Form JSON Schma",
  "type": "object",
  "required": [
    "foo",
    "bar"
  ],
  "properties": {
    "foo": {
      "title": "Foo",
      "type": "string",
      "description": "Foo rendered as normal input field"
    },
    "bar": {
      "title": "Bar",
      "type": "string",
      "description": "Bar rendered as editor with syntax highliting for jinja2",
      "x-display": "editor-jinja2"
    },
    "bool": {
      "title": "bool",
      "type": "boolean",
      "description": "boolean is rendered as checkbox"
    }
  }
}

Will render this form:

Form from Example JSON schema

Fields:

  • $id: global identifier, used if multiple forms are renderd on one page
  • $schema: _reference to the json schema for validation (use http://json-schema.org/draft-07/schema#)
  • title: form title or on sub-element field title
  • type: globally it's always an object (which holds sub-elements in properties), on fields it defines all common data types (string, boolean, number and more)
  • required: used for validation, which fields are required
  • properties: sub-elements
  • x-display: used to affect form rendering

Form more information checkout the ressources below.

Ressources