Survey: Difference between revisions

From Wikisphere
Jump to navigation Jump to search
Created page with "{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Survey Input", "description": "A flexible survey question format supporting multiple data types.", "type": "object", "properties": { "type": { "type": "string", "enum": ["scale", "yes-no", "simple", "nested"], "description": "Type of survey input" }, "rows": { "type": "array", "description": "List of rows (survey items)", "items": { "type":..."
 
Admin changed the content model of the page JsonSchema:Survey from "wikitext" to "JSON"
 
Line 1: Line 1:
{
{
  "$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Survey Input",
"title": "Survey Input",
  "description": "A flexible survey question format supporting multiple data types.",
"description": "A flexible survey question format supporting multiple data types.",
  "type": "object",
"type": "object",
  "properties": {
"properties": {
    "type": {
"type": {
      "type": "string",
"type": "string",
      "enum": ["scale", "yes-no", "simple", "nested"],
"enum": [
      "description": "Type of survey input"
"scale",
    },
"yes-no",
    "rows": {
"simple",
      "type": "array",
"nested"
      "description": "List of rows (survey items)",
],
      "items": {
"description": "Type of survey input"
        "type": "object",
},
        "properties": {
"rows": {
          "name": { "type": "string" },
"type": "array",
          "label": { "type": "string" }
"description": "List of rows (survey items)",
        },
"items": {
        "required": ["name", "label"]
"type": "object",
      }
"properties": {
    },
"name": {
    "columns": {
"type": "string"
      "type": "array",
},
      "description": "Optional columns (for formats like simple/nested)",
"label": {
      "items": {
"type": "string"
        "type": "object",
}
        "properties": {
},
          "name": { "type": "string" },
"required": [
          "label": { "type": "string" },
"name",
          "field": { "type": "string" }
"label"
        },
]
        "required": ["name", "label"]
}
      }
},
    },
"columns": {
    "maxValue": {
"type": "array",
      "type": "integer",
"description": "Optional columns (for formats like simple/nested)",
      "minimum": 1,
"items": {
      "description": "Maximum scale value (for type = 'scale')"
"type": "object",
    },
"properties": {
    "startAt": {
"name": {
      "type": "integer",
"type": "string"
      "enum": [0, 1],
},
      "description": "Starting value for scale (0 or 1)"
"label": {
    },
"type": "string"
    "allowNull": {
},
      "type": "boolean",
"field": {
      "default": false,
"type": "string"
      "description": "Whether null values are allowed"
}
    },
},
    "data": {
"required": [
      "description": "Actual survey responses",
"name",
      "type": "object"
"label"
    }
]
  },
}
  "required": ["type", "rows", "data"],
},
 
"maxValue": {
  "allOf": [
"type": "integer",
    {
"minimum": 1,
      "if": { "properties": { "type": { "const": "scale" } } },
"description": "Maximum scale value (for type = 'scale')"
      "then": {
},
        "properties": {
"startAt": {
          "data": {
"type": "integer",
            "patternProperties": {
"enum": [
              ".*": { "type": ["integer", "null"], "minimum": 0 }
0,
            }
1
          }
],
        }
"description": "Starting value for scale (0 or 1)"
      }
},
    },
"allowNull": {
    {
"type": "boolean",
      "if": { "properties": { "type": { "const": "yes-no" } } },
"default": false,
      "then": {
"description": "Whether null values are allowed"
        "properties": {
},
          "data": {
"data": {
            "patternProperties": {
"description": "Actual survey responses",
              ".*": { "type": ["boolean", "null"] }
"type": "object"
            }
}
          }
},
        }
"required": [
      }
"type",
    },
"rows",
    {
"data"
      "if": { "properties": { "type": { "const": "simple" } } },
],
      "then": {
"allOf": [
        "properties": {
{
          "data": {
"if": {
            "patternProperties": {
"properties": {
              ".*": {
"type": {
                "oneOf": [
"const": "scale"
                  { "type": "string" },
}
                  { "type": "array", "items": { "type": "string" } }
}
                ]
},
              }
"then": {
            }
"properties": {
          }
"data": {
        }
"patternProperties": {
      }
".*": {
    },
"type": [
    {
"integer",
      "if": { "properties": { "type": { "const": "nested" } } },
"null"
      "then": {
],
        "properties": {
"minimum": 0
          "data": {
}
            "patternProperties": {
}
              ".*": {
}
                "type": "object",
}
                "additionalProperties": { "type": "number" }
}
              }
},
            }
{
          }
"if": {
        }
"properties": {
      }
"type": {
    }
"const": "yes-no"
  ]
}
}
},
"then": {
"properties": {
"data": {
"patternProperties": {
".*": {
"type": [
"boolean",
"null"
]
}
}
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "simple"
}
}
},
"then": {
"properties": {
"data": {
"patternProperties": {
".*": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "nested"
}
}
},
"then": {
"properties": {
"data": {
"patternProperties": {
".*": {
"type": "object",
"additionalProperties": {
"type": "number"
}
}
}
}
}
}
}
]
}
}

Latest revision as of 06:54, 5 November 2025

$schema"http://json-schema.org/draft-07/schema#"
title"Survey Input"
description"A flexible survey question format supporting multiple data types."
type"object"
properties
type
type"string"
enum
"scale"
"yes-no"
"simple"
"nested"
description"Type of survey input"
rows
type"array"
description"List of rows (survey items)"
items
type"object"
properties
name
type"string"
label
type"string"
required
"name"
"label"
columns
type"array"
description"Optional columns (for formats like simple/nested)"
items
type"object"
properties
name
type"string"
label
type"string"
field
type"string"
required
"name"
"label"
maxValue
type"integer"
minimum1
description"Maximum scale value (for type = 'scale')"
startAt
type"integer"
enum
0
1
description"Starting value for scale (0 or 1)"
allowNull
type"boolean"
defaultfalse
description"Whether null values are allowed"
data
description"Actual survey responses"
type"object"
required
"type"
"rows"
"data"
allOf
if
properties
type
const"scale"
then
properties
data
patternProperties
.*
type
"integer"
"null"
minimum0
if
properties
type
const"yes-no"
then
properties
data
patternProperties
.*
type
"boolean"
"null"
if
properties
type
const"simple"
then
properties
data
patternProperties
.*
oneOf
type"string"
type"array"
items
type"string"
if
properties
type
const"nested"
then
properties
data
patternProperties
.*
type"object"
additionalProperties
type"number"