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
Line 
1{
2  "$schema": "http://json-schema.org/draft-04/schema#",
3  "title": "QED Object Schema",
4  "version": "4",
5  "type": "object",
6  "oneOf": [
7    { "$ref": "#/definitions/schemaInfo" },
8    { "$ref": "#/definitions/docs/any" }
9  ],
10  "definitions": {
11    "nonEmptyString": { "type": "string", "minLength": 1 },
12    "codeString": { "type": "string", "pattern": "^[A-Za-z0-9]+$" },
13    "schemaInfo": {
14      "type": "object",
15      "properties": {
16          "_id": { "type": "string", "pattern": "^schemaInfo$" },
17          "_rev": { "$ref": "#/definitions/nonEmptyString" },
18          "version": { "$ref": "#/definitions/nonEmptyString" }
19      },
20      "required": ["_id","version"],
21      "additionalProperties": false
22    },
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        ]
32      },
33      "Question": {
34        "type": "object",
35        "properties": {
36          "type": { "type": "string", "pattern": "^Question$" },
37          "_id": { "$ref": "#/definitions/nonEmptyString" },
38          "_rev": { "$ref": "#/definitions/nonEmptyString" },
39          "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } },
40          "code": { "$ref": "#/definitions/codeString" },
41          "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } },
42          "description": { "$ref": "#/definitions/nonEmptyString" },
43          "publicationDate": { "type": "string", "format": "datetime" },
44          "title": { "$ref": "#/definitions/nonEmptyString" },
45          "topic": { "$ref": "#/definitions/nonEmptyString" }
46        },
47        "required": ["type","categories","code","content","title"],
48        "additionalProperties": false
49      },
50      "Survey": {
51        "type": "object",
52        "properties": {
53          "type": { "type": "string", "pattern": "^Survey$" },
54          "_id": { "$ref": "#/definitions/nonEmptyString" },
55          "_rev": { "$ref": "#/definitions/nonEmptyString" },
56          "description": { "$ref": "#/definitions/nonEmptyString" },
57          "publicationDate": { "type": "string", "format": "datetime" },
58          "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } },
59          "title": { "$ref": "#/definitions/nonEmptyString" }
60        },
61        "required": ["type","questions","title"],
62        "additionalProperties": false
63      },
64      "SurveyRun": {
65        "type": "object",
66        "properties": {
67          "type": { "type": "string", "pattern": "^SurveyRun$" },
68          "_id": { "$ref": "#/definitions/nonEmptyString" },
69          "_rev": { "$ref": "#/definitions/nonEmptyString" },
70          "description": { "$ref": "#/definitions/nonEmptyString" },
71          "endDate": { "type": "string", "format": "datetime" },
72          "liveName": { "$ref": "#/definitions/nonEmptyString" },
73          "mode": { "type": "string", "enum": [ "open", "closed" ] },
74          "respondentCanDeleteOwnResponse": { "type": "boolean" },
75          "secret": { "$ref": "#/definitions/nonEmptyString" },
76          "startDate": { "type": "string", "format": "datetime" },
77          "survey": { "$ref": "#/definitions/docs/Survey" },
78          "title": { "$ref": "#/definitions/nonEmptyString" }
79        },
80        "required": ["type","mode","secret","survey","title"],
81        "additionalProperties": false
82      },
83      "Response": {
84        "type": "object",
85        "properties": {
86          "type": { "type": "string", "pattern": "^Response$" },
87          "_id": { "$ref": "#/definitions/nonEmptyString" },
88          "_rev": { "$ref": "#/definitions/nonEmptyString" },
89          "answers": {
90              "type": "object",
91              "patternProperties": {
92                  "^[A-Za-z0-9]+$": { "type": ["string","number"] }
93              },
94              "additionalProperties": false
95          },
96          "email": { "type": "string", "format": "email" },
97          "publicationDate": { "type": "string", "format": "datetime" },
98          "secret": { "$ref": "#/definitions/nonEmptyString" },
99          "surveyRunId": { "$ref": "#/definitions/nonEmptyString" }
100        },
101        "required": ["type","answers","secret","surveyRunId"],
102        "additionalProperties": false
103      }
104    },
105    "content": {
106      "any": {
107        "type": "object",
108        "oneOf": [
109          { "$ref": "#/definitions/content/Header" },
110          { "$ref": "#/definitions/content/Text" },
111          { "$ref": "#/definitions/content/Divider" },
112          { "$ref": "#/definitions/content/StringInput" },
113          { "$ref": "#/definitions/content/TextInput" },
114          { "$ref": "#/definitions/content/NumberInput" },
115          { "$ref": "#/definitions/content/ScaleInput" },
116          { "$ref": "#/definitions/content/SingleChoiceInput" },
117          { "$ref": "#/definitions/content/MultipleChoiceInput" }
118        ]
119      },
120      "Header": {
121        "type": "object",
122        "properties": {
123          "type": { "type": "string", "pattern": "^Header$" },
124          "text": { "$ref": "#/definitions/nonEmptyString" }
125        },
126        "required": ["type","text"],
127        "additionalProperties": false
128      },
129      "Text": {
130        "type": "object",
131        "properties": {
132          "type": { "type": "string", "pattern": "^Text$" },
133          "text": { "$ref": "#/definitions/nonEmptyString" }
134        },
135        "required": ["type","text"],
136        "additionalProperties": false
137      },
138      "Divider": {
139        "type": "object",
140        "properties": {
141          "type": { "type": "string", "pattern": "^Divider$" }
142        },
143        "additionalProperties": false
144      },
145      "StringInput": {
146        "type": "object",
147        "properties": {
148          "type": { "type": "string", "pattern": "^StringInput$" },
149          "subcode": { "$ref": "#/definitions/codeString" },
150          "text": { "$ref": "#/definitions/nonEmptyString" }
151        },
152        "required":["type","subcode"],
153        "additionalProperties": false
154      },
155      "TextInput": {
156        "type": "object",
157        "properties": {
158          "type": { "type": "string", "pattern": "^TextInput$" },
159          "maxLength": { "type": "integer" },
160          "subcode": { "$ref": "#/definitions/codeString" },
161          "text": { "$ref": "#/definitions/nonEmptyString" }
162        },
163        "required":["type","subcode"],
164        "additionalProperties": false
165      },
166      "NumberInput": {
167        "type": "object",
168        "properties": {
169          "type": { "type": "string", "pattern": "^NumberInput$" },
170          "min": { "type": "integer" },
171          "max": { "type": "integer" },
172          "places": { "type": "integer" },
173          "subcode": { "$ref": "#/definitions/codeString" },
174          "text": { "$ref": "#/definitions/nonEmptyString" }
175        },
176        "required":["type","subcode"],
177        "additionalProperties": false
178      },
179      "ScaleInput": {
180        "type": "object",
181        "properties": {
182          "type": { "type": "string", "pattern": "^ScaleInput$" },
183          "minLabel": { "$ref": "#/definitions/nonEmptyString" },
184          "min": { "type": "integer" },
185          "max": { "type": "integer" },
186          "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
187          "naLabel": { "$ref": "#/definitions/nonEmptyString" },
188          "items": { "type": "array", "items": {
189            "type": "object",
190            "properties": {
191              "minLabel": { "$ref": "#/definitions/nonEmptyString" },
192              "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
193              "subcode": { "$ref": "#/definitions/codeString" },
194              "text": { "$ref": "#/definitions/nonEmptyString" }
195            },
196            "required":["subcode","text"],
197            "additionalProperties": false
198          } }
199        },
200        "required":["type","min","max","items"],
201        "additionalProperties": false
202      },
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          "lastItemIsOpen": {
217              "type": "object",
218              "properties": {
219                  "subcode": { "$ref": "#/definitions/codeString" }
220              },
221              "required": ["subcode"],
222              "additionalProperties": false
223          },
224          "subcode": { "$ref": "#/definitions/codeString" }
225        },
226        "required":["type","items","subcode"],
227        "additionalProperties": false
228      },
229      "MultipleChoiceInput": {
230        "type": "object",
231        "properties": {
232          "type": { "type": "string", "pattern": "^MultipleChoiceInput$" },
233          "items": { "type": "array", "items": {
234              "type": "object",
235              "properties": {
236                "subcode": { "$ref": "#/definitions/codeString" },
237                "text": { "$ref": "#/definitions/nonEmptyString" }
238              },
239              "required": ["subcode","text"],
240              "additionalProperties": false
241          } },
242          "lastItemIsOpen": {
243              "type": "object",
244              "properties": {
245                "subcode": { "$ref": "#/definitions/codeString" }
246              },
247              "required": ["subcode"],
248              "additionalProperties": false
249          }
250        },
251        "required":["type","items"],
252        "additionalProperties": false
253      }
254    }
255  }
256}
Note: See TracBrowser for help on using the repository browser.