source: Dev/trunk/src/server/config/couchdb-schema.json @ 511

Last change on this file since 511 was 511, checked in by hendrikvanantwerpen, 11 years ago
  • Added open item options to singe and multiple choice.
  • Question view widgets are forms again, because we needed the control.
  • Multiple and singel choice share their widgets.
  • QuestionEditorPreview? now has items that were already there close, but opens newly dropped items.
  • PreviewItems? will save modified value even when we change to view before the widget loses its focus (which causes a change event).
File size: 9.7 KB
RevLine 
[479]1{
[487]2  "$schema": "http://json-schema.org/draft-04/schema#",
[479]3  "title": "QED Object Schema",
[508]4  "version": "4",
[480]5  "type": "object",
6  "oneOf": [
[487]7    { "$ref": "#/definitions/schemaInfo" },
8    { "$ref": "#/definitions/docs/any" }
[480]9  ],
[487]10  "definitions": {
[506]11    "nonEmptyString": { "type": "string", "minLength": 1 },
[508]12    "codeString": { "type": "string", "pattern": "^[A-Za-z0-9]+$" },
[487]13    "schemaInfo": {
[479]14      "type": "object",
15      "properties": {
[499]16          "_id": { "type": "string", "pattern": "^schemaInfo$" },
[506]17          "_rev": { "$ref": "#/definitions/nonEmptyString" },
18          "version": { "$ref": "#/definitions/nonEmptyString" }
[479]19      },
[487]20      "required": ["_id","version"],
[479]21      "additionalProperties": false
22    },
[487]23    "docs": {
24      "any": {
25        "type": "object",
26        "oneOf":[
27          { "$ref": "#/definitions/docs/Question" },
28          { "$ref": "#/definitions/docs/Survey" },
29          { "$ref": "#/definitions/docs/SurveyRun" },
30          { "$ref": "#/definitions/docs/Response" }
31        ]
[479]32      },
[487]33      "Question": {
34        "type": "object",
35        "properties": {
[499]36          "type": { "type": "string", "pattern": "^Question$" },
[506]37          "_id": { "$ref": "#/definitions/nonEmptyString" },
38          "_rev": { "$ref": "#/definitions/nonEmptyString" },
39          "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } },
[508]40          "code": { "$ref": "#/definitions/codeString" },
[487]41          "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } },
[506]42          "description": { "$ref": "#/definitions/nonEmptyString" },
[487]43          "publicationDate": { "type": "string", "format": "datetime" },
[506]44          "title": { "$ref": "#/definitions/nonEmptyString" },
45          "topic": { "$ref": "#/definitions/nonEmptyString" }
[487]46        },
47        "required": ["type","categories","code","content","title"],
48        "additionalProperties": false
[479]49      },
[487]50      "Survey": {
51        "type": "object",
52        "properties": {
[499]53          "type": { "type": "string", "pattern": "^Survey$" },
[506]54          "_id": { "$ref": "#/definitions/nonEmptyString" },
55          "_rev": { "$ref": "#/definitions/nonEmptyString" },
56          "description": { "$ref": "#/definitions/nonEmptyString" },
[487]57          "publicationDate": { "type": "string", "format": "datetime" },
58          "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } },
[506]59          "title": { "$ref": "#/definitions/nonEmptyString" }
[487]60        },
61        "required": ["type","questions","title"],
62        "additionalProperties": false
[479]63      },
[487]64      "SurveyRun": {
[479]65        "type": "object",
66        "properties": {
[499]67          "type": { "type": "string", "pattern": "^SurveyRun$" },
[506]68          "_id": { "$ref": "#/definitions/nonEmptyString" },
69          "_rev": { "$ref": "#/definitions/nonEmptyString" },
70          "description": { "$ref": "#/definitions/nonEmptyString" },
[487]71          "endDate": { "type": "string", "format": "datetime" },
[506]72          "liveName": { "$ref": "#/definitions/nonEmptyString" },
[487]73          "mode": { "type": "string", "enum": [ "open", "closed" ] },
[492]74          "respondentCanDeleteOwnResponse": { "type": "boolean" },
[506]75          "secret": { "$ref": "#/definitions/nonEmptyString" },
[487]76          "startDate": { "type": "string", "format": "datetime" },
77          "survey": { "$ref": "#/definitions/docs/Survey" },
[506]78          "title": { "$ref": "#/definitions/nonEmptyString" }
[479]79        },
[506]80        "required": ["type","mode","secret","survey","title"],
[479]81        "additionalProperties": false
[487]82      },
83      "Response": {
[479]84        "type": "object",
85        "properties": {
[499]86          "type": { "type": "string", "pattern": "^Response$" },
[506]87          "_id": { "$ref": "#/definitions/nonEmptyString" },
88          "_rev": { "$ref": "#/definitions/nonEmptyString" },
[508]89          "answers": {
90              "type": "object",
91              "patternProperties": {
[509]92                  "^[A-Za-z0-9]+$": { "type": ["string","number"] }
[508]93              },
94              "additionalProperties": false
95          },
[492]96          "email": { "type": "string", "format": "email" },
[487]97          "publicationDate": { "type": "string", "format": "datetime" },
[506]98          "secret": { "$ref": "#/definitions/nonEmptyString" },
99          "surveyRunId": { "$ref": "#/definitions/nonEmptyString" }
[479]100        },
[487]101        "required": ["type","answers","secret","surveyRunId"],
[479]102        "additionalProperties": false
[487]103      }
[479]104    },
[506]105    "content": {
[487]106      "any": {
[479]107        "type": "object",
[487]108        "oneOf": [
[493]109          { "$ref": "#/definitions/content/Header" },
[487]110          { "$ref": "#/definitions/content/Text" },
[493]111          { "$ref": "#/definitions/content/Divider" },
[487]112          { "$ref": "#/definitions/content/StringInput" },
[493]113          { "$ref": "#/definitions/content/TextInput" },
114          { "$ref": "#/definitions/content/NumberInput" },
115          { "$ref": "#/definitions/content/ScaleInput" },
[510]116          { "$ref": "#/definitions/content/SingleChoiceInput" },
[493]117          { "$ref": "#/definitions/content/MultipleChoiceInput" }
[487]118        ]
119      },
[493]120      "Header": {
121        "type": "object",
122        "properties": {
[499]123          "type": { "type": "string", "pattern": "^Header$" },
[506]124          "text": { "$ref": "#/definitions/nonEmptyString" }
[493]125        },
126        "required": ["type","text"],
127        "additionalProperties": false
128      },
[487]129      "Text": {
130        "type": "object",
[479]131        "properties": {
[499]132          "type": { "type": "string", "pattern": "^Text$" },
[506]133          "text": { "$ref": "#/definitions/nonEmptyString" }
[479]134        },
[487]135        "required": ["type","text"],
[479]136        "additionalProperties": false
[487]137      },
[493]138      "Divider": {
139        "type": "object",
140        "properties": {
[499]141          "type": { "type": "string", "pattern": "^Divider$" }
[493]142        },
143        "additionalProperties": false
144      },
[487]145      "StringInput": {
146        "type": "object",
147        "properties": {
[499]148          "type": { "type": "string", "pattern": "^StringInput$" },
[508]149          "subcode": { "$ref": "#/definitions/codeString" },
[506]150          "text": { "$ref": "#/definitions/nonEmptyString" }
[487]151        },
[506]152        "required":["type","subcode"],
[487]153        "additionalProperties": false
154      },
[493]155      "TextInput": {
156        "type": "object",
157        "properties": {
[499]158          "type": { "type": "string", "pattern": "^TextInput$" },
[493]159          "maxLength": { "type": "integer" },
[508]160          "subcode": { "$ref": "#/definitions/codeString" },
[506]161          "text": { "$ref": "#/definitions/nonEmptyString" }
[493]162        },
[506]163        "required":["type","subcode"],
[493]164        "additionalProperties": false
165      },
166      "NumberInput": {
167        "type": "object",
168        "properties": {
[499]169          "type": { "type": "string", "pattern": "^NumberInput$" },
[493]170          "min": { "type": "integer" },
171          "max": { "type": "integer" },
172          "places": { "type": "integer" },
[508]173          "subcode": { "$ref": "#/definitions/codeString" },
[506]174          "text": { "$ref": "#/definitions/nonEmptyString" }
[493]175        },
[506]176        "required":["type","subcode"],
[493]177        "additionalProperties": false
178      },
[487]179      "ScaleInput": {
180        "type": "object",
181        "properties": {
[499]182          "type": { "type": "string", "pattern": "^ScaleInput$" },
[506]183          "minLabel": { "$ref": "#/definitions/nonEmptyString" },
[487]184          "min": { "type": "integer" },
185          "max": { "type": "integer" },
[506]186          "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
187          "naLabel": { "$ref": "#/definitions/nonEmptyString" },
[487]188          "items": { "type": "array", "items": {
189            "type": "object",
190            "properties": {
[506]191              "minLabel": { "$ref": "#/definitions/nonEmptyString" },
192              "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
[508]193              "subcode": { "$ref": "#/definitions/codeString" },
[506]194              "text": { "$ref": "#/definitions/nonEmptyString" }
[487]195            },
[506]196            "required":["subcode","text"],
[487]197            "additionalProperties": false
198          } }
199        },
200        "required":["type","min","max","items"],
201        "additionalProperties": false
[493]202      },
[510]203      "SingleChoiceInput": {
204        "type": "object",
205        "properties": {
206          "type": { "type": "string", "pattern": "^SingleChoiceInput$" },
207          "items": { "type": "array", "items": {
208              "type": "object",
209              "properties": {
210                  "text": { "$ref": "#/definitions/nonEmptyString" },
211                  "value": { "$ref": "#/definitions/nonEmptyString" }
212              },
213              "required": ["text","value"],
214              "additionalProperties": false
215          } },
[511]216          "lastItemIsOpen": {
[510]217              "type": "object",
218              "properties": {
[511]219                  "subcode": { "$ref": "#/definitions/codeString" }
[510]220              },
[511]221              "required": ["subcode"],
[510]222              "additionalProperties": false
223          },
224          "subcode": { "$ref": "#/definitions/codeString" }
225        },
226        "required":["type","items","subcode"],
227        "additionalProperties": false
228      },
[493]229      "MultipleChoiceInput": {
230        "type": "object",
231        "properties": {
[499]232          "type": { "type": "string", "pattern": "^MultipleChoiceInput$" },
[493]233          "items": { "type": "array", "items": {
234              "type": "object",
235              "properties": {
[511]236                "subcode": { "$ref": "#/definitions/codeString" },
237                "text": { "$ref": "#/definitions/nonEmptyString" }
[493]238              },
[506]239              "required": ["subcode","text"],
[493]240              "additionalProperties": false
[506]241          } },
[511]242          "lastItemIsOpen": {
[506]243              "type": "object",
244              "properties": {
[511]245                "subcode": { "$ref": "#/definitions/codeString" }
[506]246              },
[511]247              "required": ["subcode"],
[506]248              "additionalProperties": false
249          }
[493]250        },
251        "required":["type","items"],
252        "additionalProperties": false
[487]253      }
[479]254    }
255  }
256}
Note: See TracBrowser for help on using the repository browser.