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

Last change on this file since 510 was 510, checked in by hendrikvanantwerpen, 11 years ago
  • Factored out general object mapping and iteration.
  • Split widgets for multiplechoice and singlechoice.
  • Restored readOnly/disabled setting for QuestionEditorPreviewItem? on innerWidget (since view innerWidget is not a form anymore, we cannot just set it on that, we iterate over all form children now).
File size: 9.9 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          } },
216          "otherItem": {
217              "type": "object",
218              "properties": {
219                  "text": { "$ref": "#/definitions/nonEmptyString" },
220                  "value": { "$ref": "#/definitions/nonEmptyString" }
221              },
222              "required": ["subcode","value"],
223              "additionalProperties": false
224          },
225          "subcode": { "$ref": "#/definitions/codeString" }
226        },
227        "required":["type","items","subcode"],
228        "additionalProperties": false
229      },
[493]230      "MultipleChoiceInput": {
231        "type": "object",
232        "properties": {
[499]233          "type": { "type": "string", "pattern": "^MultipleChoiceInput$" },
[493]234          "items": { "type": "array", "items": {
235              "type": "object",
236              "properties": {
[508]237                  "subcode": { "$ref": "#/definitions/codeString" },
[506]238                  "text": { "$ref": "#/definitions/nonEmptyString" }
[493]239              },
[506]240              "required": ["subcode","text"],
[493]241              "additionalProperties": false
[506]242          } },
243          "otherItem": {
244              "type": "object",
245              "properties": {
[508]246                  "subcode": { "$ref": "#/definitions/codeString" },
[506]247                  "text": { "$ref": "#/definitions/nonEmptyString" }
248              },
249              "required": ["subcode","text"],
250              "additionalProperties": false
251          }
[493]252        },
253        "required":["type","items"],
254        "additionalProperties": false
[487]255      }
[479]256    }
257  }
258}
Note: See TracBrowser for help on using the repository browser.