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 | "code": { "type": "string", "pattern": "^[A-Za-z0-9]+$" }, |
---|
13 | "subcode": { "type": "string", "pattern": "^[A-Za-z0-9]*$" }, |
---|
14 | "datetime": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$"}, |
---|
15 | "html5Email": {"type": "string", "pattern": "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"}, |
---|
16 | "schemaInfo": { |
---|
17 | "type": "object", |
---|
18 | "properties": { |
---|
19 | "_id": { "type": "string", "pattern": "^schemaInfo$" }, |
---|
20 | "_rev": { "$ref": "#/definitions/nonEmptyString" }, |
---|
21 | "version": { "$ref": "#/definitions/nonEmptyString" }, |
---|
22 | "viewsVersion": { "$ref": "#/definitions/nonEmptyString" } |
---|
23 | }, |
---|
24 | "required": ["_id","version"], |
---|
25 | "additionalProperties": false |
---|
26 | }, |
---|
27 | "docs": { |
---|
28 | "any": { |
---|
29 | "type": "object", |
---|
30 | "oneOf":[ |
---|
31 | { "$ref": "#/definitions/docs/Question" }, |
---|
32 | { "$ref": "#/definitions/docs/Survey" }, |
---|
33 | { "$ref": "#/definitions/docs/SurveyRun" }, |
---|
34 | { "$ref": "#/definitions/docs/Response" } |
---|
35 | ] |
---|
36 | }, |
---|
37 | "Question": { |
---|
38 | "type": "object", |
---|
39 | "properties": { |
---|
40 | "type": { "type": "string", "pattern": "^Question$" }, |
---|
41 | "_id": { "$ref": "#/definitions/nonEmptyString" }, |
---|
42 | "_rev": { "$ref": "#/definitions/nonEmptyString" }, |
---|
43 | "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } }, |
---|
44 | "code": { "$ref": "#/definitions/code" }, |
---|
45 | "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } }, |
---|
46 | "description": { "$ref": "#/definitions/nonEmptyString" }, |
---|
47 | "publicationDate": { "$ref": "#/definitions/datetime" }, |
---|
48 | "title": { "$ref": "#/definitions/nonEmptyString" }, |
---|
49 | "topic": { "$ref": "#/definitions/nonEmptyString" } |
---|
50 | }, |
---|
51 | "required": ["type","categories","code","content","title"], |
---|
52 | "additionalProperties": false |
---|
53 | }, |
---|
54 | "Survey": { |
---|
55 | "type": "object", |
---|
56 | "properties": { |
---|
57 | "type": { "type": "string", "pattern": "^Survey$" }, |
---|
58 | "_id": { "$ref": "#/definitions/nonEmptyString" }, |
---|
59 | "_rev": { "$ref": "#/definitions/nonEmptyString" }, |
---|
60 | "description": { "$ref": "#/definitions/nonEmptyString" }, |
---|
61 | "publicationDate": { "$ref": "#/definitions/datetime" }, |
---|
62 | "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } }, |
---|
63 | "title": { "$ref": "#/definitions/nonEmptyString" } |
---|
64 | }, |
---|
65 | "required": ["type","questions","title"], |
---|
66 | "additionalProperties": false |
---|
67 | }, |
---|
68 | "SurveyRun": { |
---|
69 | "type": "object", |
---|
70 | "properties": { |
---|
71 | "type": { "type": "string", "pattern": "^SurveyRun$" }, |
---|
72 | "_id": { "$ref": "#/definitions/nonEmptyString" }, |
---|
73 | "_rev": { "$ref": "#/definitions/nonEmptyString" }, |
---|
74 | "description": { "$ref": "#/definitions/nonEmptyString" }, |
---|
75 | "endDate": { "$ref": "#/definitions/datetime" }, |
---|
76 | "mode": { "type": "string", "enum": [ "open", "closed" ] }, |
---|
77 | "respondentCanDeleteOwnResponse": { "type": "boolean" }, |
---|
78 | "secret": { "$ref": "#/definitions/nonEmptyString" }, |
---|
79 | "startDate": { "$ref": "#/definitions/datetime" }, |
---|
80 | "survey": { "$ref": "#/definitions/docs/Survey" }, |
---|
81 | "title": { "$ref": "#/definitions/nonEmptyString" } |
---|
82 | }, |
---|
83 | "required": ["type","mode","secret","survey","title"], |
---|
84 | "additionalProperties": false |
---|
85 | }, |
---|
86 | "Response": { |
---|
87 | "type": "object", |
---|
88 | "properties": { |
---|
89 | "type": { "type": "string", "pattern": "^Response$" }, |
---|
90 | "_id": { "$ref": "#/definitions/nonEmptyString" }, |
---|
91 | "_rev": { "$ref": "#/definitions/nonEmptyString" }, |
---|
92 | "answers": { |
---|
93 | "type": "object", |
---|
94 | "patternProperties": { |
---|
95 | "^[A-Za-z0-9]+$": { "type": ["string","number"] } |
---|
96 | }, |
---|
97 | "additionalProperties": false |
---|
98 | }, |
---|
99 | "publicationDate": { "$ref": "#/definitions/datetime" }, |
---|
100 | "secret": { "$ref": "#/definitions/nonEmptyString" }, |
---|
101 | "surveyRunId": { "$ref": "#/definitions/nonEmptyString" } |
---|
102 | }, |
---|
103 | "required": ["type","answers","secret","surveyRunId"], |
---|
104 | "additionalProperties": false |
---|
105 | } |
---|
106 | }, |
---|
107 | "content": { |
---|
108 | "any": { |
---|
109 | "type": "object", |
---|
110 | "oneOf": [ |
---|
111 | { "$ref": "#/definitions/content/Header" }, |
---|
112 | { "$ref": "#/definitions/content/Text" }, |
---|
113 | { "$ref": "#/definitions/content/Divider" }, |
---|
114 | { "$ref": "#/definitions/content/StringInput" }, |
---|
115 | { "$ref": "#/definitions/content/TextInput" }, |
---|
116 | { "$ref": "#/definitions/content/NumberInput" }, |
---|
117 | { "$ref": "#/definitions/content/ScaleInput" }, |
---|
118 | { "$ref": "#/definitions/content/SingleChoiceInput" }, |
---|
119 | { "$ref": "#/definitions/content/MultipleChoiceInput" } |
---|
120 | ] |
---|
121 | }, |
---|
122 | "Header": { |
---|
123 | "type": "object", |
---|
124 | "properties": { |
---|
125 | "type": { "type": "string", "pattern": "^Header$" }, |
---|
126 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
127 | }, |
---|
128 | "required": ["type","text"], |
---|
129 | "additionalProperties": false |
---|
130 | }, |
---|
131 | "Text": { |
---|
132 | "type": "object", |
---|
133 | "properties": { |
---|
134 | "type": { "type": "string", "pattern": "^Text$" }, |
---|
135 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
136 | }, |
---|
137 | "required": ["type","text"], |
---|
138 | "additionalProperties": false |
---|
139 | }, |
---|
140 | "Divider": { |
---|
141 | "type": "object", |
---|
142 | "properties": { |
---|
143 | "type": { "type": "string", "pattern": "^Divider$" } |
---|
144 | }, |
---|
145 | "additionalProperties": false |
---|
146 | }, |
---|
147 | "StringInput": { |
---|
148 | "type": "object", |
---|
149 | "properties": { |
---|
150 | "type": { "type": "string", "pattern": "^StringInput$" }, |
---|
151 | "subcode": { "$ref": "#/definitions/subcode" }, |
---|
152 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
153 | }, |
---|
154 | "required":["type","subcode"], |
---|
155 | "additionalProperties": false |
---|
156 | }, |
---|
157 | "TextInput": { |
---|
158 | "type": "object", |
---|
159 | "properties": { |
---|
160 | "type": { "type": "string", "pattern": "^TextInput$" }, |
---|
161 | "maxLength": { "type": "integer" }, |
---|
162 | "subcode": { "$ref": "#/definitions/subcode" }, |
---|
163 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
164 | }, |
---|
165 | "required":["type","subcode"], |
---|
166 | "additionalProperties": false |
---|
167 | }, |
---|
168 | "NumberInput": { |
---|
169 | "type": "object", |
---|
170 | "properties": { |
---|
171 | "type": { "type": "string", "pattern": "^NumberInput$" }, |
---|
172 | "min": { "type": "integer" }, |
---|
173 | "max": { "type": "integer" }, |
---|
174 | "places": { "type": "integer" }, |
---|
175 | "subcode": { "$ref": "#/definitions/subcode" }, |
---|
176 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
177 | }, |
---|
178 | "required":["type","subcode"], |
---|
179 | "additionalProperties": false |
---|
180 | }, |
---|
181 | "ScaleInput": { |
---|
182 | "type": "object", |
---|
183 | "properties": { |
---|
184 | "type": { "type": "string", "pattern": "^ScaleInput$" }, |
---|
185 | "minLabel": { "$ref": "#/definitions/nonEmptyString" }, |
---|
186 | "min": { "type": "integer" }, |
---|
187 | "max": { "type": "integer" }, |
---|
188 | "maxLabel": { "$ref": "#/definitions/nonEmptyString" }, |
---|
189 | "naLabel": { "$ref": "#/definitions/nonEmptyString" }, |
---|
190 | "items": { "type": "array", "items": { |
---|
191 | "type": "object", |
---|
192 | "properties": { |
---|
193 | "minLabel": { "$ref": "#/definitions/nonEmptyString" }, |
---|
194 | "maxLabel": { "$ref": "#/definitions/nonEmptyString" }, |
---|
195 | "subcode": { "$ref": "#/definitions/subcode" }, |
---|
196 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
197 | }, |
---|
198 | "required":["subcode","text"], |
---|
199 | "additionalProperties": false |
---|
200 | } } |
---|
201 | }, |
---|
202 | "required":["type","min","max","items"], |
---|
203 | "additionalProperties": false |
---|
204 | }, |
---|
205 | "SingleChoiceInput": { |
---|
206 | "type": "object", |
---|
207 | "properties": { |
---|
208 | "type": { "type": "string", "pattern": "^SingleChoiceInput$" }, |
---|
209 | "items": { "type": "array", "items": { |
---|
210 | "type": "object", |
---|
211 | "properties": { |
---|
212 | "text": { "$ref": "#/definitions/nonEmptyString" }, |
---|
213 | "value": { "$ref": "#/definitions/nonEmptyString" } |
---|
214 | }, |
---|
215 | "required": ["text","value"], |
---|
216 | "additionalProperties": false |
---|
217 | } }, |
---|
218 | "lastItemIsOpen": { |
---|
219 | "type": "object", |
---|
220 | "properties": { |
---|
221 | "subcode": { "$ref": "#/definitions/subcode" } |
---|
222 | }, |
---|
223 | "required": ["subcode"], |
---|
224 | "additionalProperties": false |
---|
225 | }, |
---|
226 | "subcode": { "$ref": "#/definitions/subcode" } |
---|
227 | }, |
---|
228 | "required":["type","items","subcode"], |
---|
229 | "additionalProperties": false |
---|
230 | }, |
---|
231 | "MultipleChoiceInput": { |
---|
232 | "type": "object", |
---|
233 | "properties": { |
---|
234 | "type": { "type": "string", "pattern": "^MultipleChoiceInput$" }, |
---|
235 | "items": { "type": "array", "items": { |
---|
236 | "type": "object", |
---|
237 | "properties": { |
---|
238 | "subcode": { "$ref": "#/definitions/subcode" }, |
---|
239 | "text": { "$ref": "#/definitions/nonEmptyString" } |
---|
240 | }, |
---|
241 | "required": ["subcode","text"], |
---|
242 | "additionalProperties": false |
---|
243 | } }, |
---|
244 | "lastItemIsOpen": { |
---|
245 | "type": "object", |
---|
246 | "properties": { |
---|
247 | "subcode": { "$ref": "#/definitions/subcode" } |
---|
248 | }, |
---|
249 | "required": ["subcode"], |
---|
250 | "additionalProperties": false |
---|
251 | } |
---|
252 | }, |
---|
253 | "required":["type","items"], |
---|
254 | "additionalProperties": false |
---|
255 | } |
---|
256 | } |
---|
257 | } |
---|
258 | } |
---|