Questionire Documentation

The questionnaire is a JSON object that holds entries for each question. Here is the schema.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "righttoleft": {
          "type": "boolean",
          "description": "Indicates if the text direction is right-to-left."
        },
        "options_use_label": {
          "type": "boolean",
          "description": "Indicates if options will be saved as labels or keys."
        }
      },
      "required": ["righttoleft", "options_use_label"]
    },
    "contents": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "q": {
            "type": "string",
            "description": "The question text."
          },
          "type": {
            "type": "string",
            "description": "The type of the question.",
            "enum": ["text", "switch", "option", "datetime", "date", "time"]
          },
          "regex": {
            "type": "string",
            "description": "Regular expression for validation (only for text fields)."
          },
          "tooltip": {
            "type": "string",
            "description": "Tooltip text for the question."
          },
          "serialiation_key": {
            "type": "string",
            "description": "Key used for serialization."
          },
          "mandatory": {
            "type": "boolean",
            "description": "Indicates if the question is mandatory."
          },
          "options": {
            "type": "array",
            "description": "List of options for 'option' type questions.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Option identifier."
                },
                "name": {
                  "type": "string",
                  "description": "Option name."
                }
              },
              "required": ["id", "name"]
            }
          },
          "conditional": {
            "type": "integer",
            "description": "Index of the question this one is conditional on."
          },
          "serialization_format": {
            "type": "string",
            "description": "Format for serializing date/time values."
          },
          "24hs": {
            "type": "boolean",
            "description": "Indicates if time should be in 24-hour format."
          }
        },
        "required": ["q", "serialiation_key"]
      }
    }
  },
  "required": ["config", "contents"]
}