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