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

Last change on this file since 523 was 523, checked in by hendrikvanantwerpen, 11 years ago
  • Added version for views.
  • Don't automatically upgrade views when starting app, this needs to be done manually.
File size: 9.8 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" },
[523]18          "version": { "$ref": "#/definitions/nonEmptyString" },
19          "viewsVersion": { "$ref": "#/definitions/nonEmptyString" }
[479]20      },
[487]21      "required": ["_id","version"],
[479]22      "additionalProperties": false
23    },
[487]24    "docs": {
25      "any": {
26        "type": "object",
27        "oneOf":[
28          { "$ref": "#/definitions/docs/Question" },
29          { "$ref": "#/definitions/docs/Survey" },
30          { "$ref": "#/definitions/docs/SurveyRun" },
31          { "$ref": "#/definitions/docs/Response" }
32        ]
[479]33      },
[487]34      "Question": {
35        "type": "object",
36        "properties": {
[499]37          "type": { "type": "string", "pattern": "^Question$" },
[506]38          "_id": { "$ref": "#/definitions/nonEmptyString" },
39          "_rev": { "$ref": "#/definitions/nonEmptyString" },
40          "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } },
[508]41          "code": { "$ref": "#/definitions/codeString" },
[487]42          "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } },
[506]43          "description": { "$ref": "#/definitions/nonEmptyString" },
[487]44          "publicationDate": { "type": "string", "format": "datetime" },
[506]45          "title": { "$ref": "#/definitions/nonEmptyString" },
46          "topic": { "$ref": "#/definitions/nonEmptyString" }
[487]47        },
48        "required": ["type","categories","code","content","title"],
49        "additionalProperties": false
[479]50      },
[487]51      "Survey": {
52        "type": "object",
53        "properties": {
[499]54          "type": { "type": "string", "pattern": "^Survey$" },
[506]55          "_id": { "$ref": "#/definitions/nonEmptyString" },
56          "_rev": { "$ref": "#/definitions/nonEmptyString" },
57          "description": { "$ref": "#/definitions/nonEmptyString" },
[487]58          "publicationDate": { "type": "string", "format": "datetime" },
59          "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } },
[506]60          "title": { "$ref": "#/definitions/nonEmptyString" }
[487]61        },
62        "required": ["type","questions","title"],
63        "additionalProperties": false
[479]64      },
[487]65      "SurveyRun": {
[479]66        "type": "object",
67        "properties": {
[499]68          "type": { "type": "string", "pattern": "^SurveyRun$" },
[506]69          "_id": { "$ref": "#/definitions/nonEmptyString" },
70          "_rev": { "$ref": "#/definitions/nonEmptyString" },
71          "description": { "$ref": "#/definitions/nonEmptyString" },
[487]72          "endDate": { "type": "string", "format": "datetime" },
[506]73          "liveName": { "$ref": "#/definitions/nonEmptyString" },
[487]74          "mode": { "type": "string", "enum": [ "open", "closed" ] },
[492]75          "respondentCanDeleteOwnResponse": { "type": "boolean" },
[506]76          "secret": { "$ref": "#/definitions/nonEmptyString" },
[487]77          "startDate": { "type": "string", "format": "datetime" },
78          "survey": { "$ref": "#/definitions/docs/Survey" },
[506]79          "title": { "$ref": "#/definitions/nonEmptyString" }
[479]80        },
[506]81        "required": ["type","mode","secret","survey","title"],
[479]82        "additionalProperties": false
[487]83      },
84      "Response": {
[479]85        "type": "object",
86        "properties": {
[499]87          "type": { "type": "string", "pattern": "^Response$" },
[506]88          "_id": { "$ref": "#/definitions/nonEmptyString" },
89          "_rev": { "$ref": "#/definitions/nonEmptyString" },
[508]90          "answers": {
91              "type": "object",
92              "patternProperties": {
[509]93                  "^[A-Za-z0-9]+$": { "type": ["string","number"] }
[508]94              },
95              "additionalProperties": false
96          },
[492]97          "email": { "type": "string", "format": "email" },
[487]98          "publicationDate": { "type": "string", "format": "datetime" },
[506]99          "secret": { "$ref": "#/definitions/nonEmptyString" },
100          "surveyRunId": { "$ref": "#/definitions/nonEmptyString" }
[479]101        },
[487]102        "required": ["type","answers","secret","surveyRunId"],
[479]103        "additionalProperties": false
[487]104      }
[479]105    },
[506]106    "content": {
[487]107      "any": {
[479]108        "type": "object",
[487]109        "oneOf": [
[493]110          { "$ref": "#/definitions/content/Header" },
[487]111          { "$ref": "#/definitions/content/Text" },
[493]112          { "$ref": "#/definitions/content/Divider" },
[487]113          { "$ref": "#/definitions/content/StringInput" },
[493]114          { "$ref": "#/definitions/content/TextInput" },
115          { "$ref": "#/definitions/content/NumberInput" },
116          { "$ref": "#/definitions/content/ScaleInput" },
[510]117          { "$ref": "#/definitions/content/SingleChoiceInput" },
[493]118          { "$ref": "#/definitions/content/MultipleChoiceInput" }
[487]119        ]
120      },
[493]121      "Header": {
122        "type": "object",
123        "properties": {
[499]124          "type": { "type": "string", "pattern": "^Header$" },
[506]125          "text": { "$ref": "#/definitions/nonEmptyString" }
[493]126        },
127        "required": ["type","text"],
128        "additionalProperties": false
129      },
[487]130      "Text": {
131        "type": "object",
[479]132        "properties": {
[499]133          "type": { "type": "string", "pattern": "^Text$" },
[506]134          "text": { "$ref": "#/definitions/nonEmptyString" }
[479]135        },
[487]136        "required": ["type","text"],
[479]137        "additionalProperties": false
[487]138      },
[493]139      "Divider": {
140        "type": "object",
141        "properties": {
[499]142          "type": { "type": "string", "pattern": "^Divider$" }
[493]143        },
144        "additionalProperties": false
145      },
[487]146      "StringInput": {
147        "type": "object",
148        "properties": {
[499]149          "type": { "type": "string", "pattern": "^StringInput$" },
[508]150          "subcode": { "$ref": "#/definitions/codeString" },
[506]151          "text": { "$ref": "#/definitions/nonEmptyString" }
[487]152        },
[506]153        "required":["type","subcode"],
[487]154        "additionalProperties": false
155      },
[493]156      "TextInput": {
157        "type": "object",
158        "properties": {
[499]159          "type": { "type": "string", "pattern": "^TextInput$" },
[493]160          "maxLength": { "type": "integer" },
[508]161          "subcode": { "$ref": "#/definitions/codeString" },
[506]162          "text": { "$ref": "#/definitions/nonEmptyString" }
[493]163        },
[506]164        "required":["type","subcode"],
[493]165        "additionalProperties": false
166      },
167      "NumberInput": {
168        "type": "object",
169        "properties": {
[499]170          "type": { "type": "string", "pattern": "^NumberInput$" },
[493]171          "min": { "type": "integer" },
172          "max": { "type": "integer" },
173          "places": { "type": "integer" },
[508]174          "subcode": { "$ref": "#/definitions/codeString" },
[506]175          "text": { "$ref": "#/definitions/nonEmptyString" }
[493]176        },
[506]177        "required":["type","subcode"],
[493]178        "additionalProperties": false
179      },
[487]180      "ScaleInput": {
181        "type": "object",
182        "properties": {
[499]183          "type": { "type": "string", "pattern": "^ScaleInput$" },
[506]184          "minLabel": { "$ref": "#/definitions/nonEmptyString" },
[487]185          "min": { "type": "integer" },
186          "max": { "type": "integer" },
[506]187          "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
188          "naLabel": { "$ref": "#/definitions/nonEmptyString" },
[487]189          "items": { "type": "array", "items": {
190            "type": "object",
191            "properties": {
[506]192              "minLabel": { "$ref": "#/definitions/nonEmptyString" },
193              "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
[508]194              "subcode": { "$ref": "#/definitions/codeString" },
[506]195              "text": { "$ref": "#/definitions/nonEmptyString" }
[487]196            },
[506]197            "required":["subcode","text"],
[487]198            "additionalProperties": false
199          } }
200        },
201        "required":["type","min","max","items"],
202        "additionalProperties": false
[493]203      },
[510]204      "SingleChoiceInput": {
205        "type": "object",
206        "properties": {
207          "type": { "type": "string", "pattern": "^SingleChoiceInput$" },
208          "items": { "type": "array", "items": {
209              "type": "object",
210              "properties": {
211                  "text": { "$ref": "#/definitions/nonEmptyString" },
212                  "value": { "$ref": "#/definitions/nonEmptyString" }
213              },
214              "required": ["text","value"],
215              "additionalProperties": false
216          } },
[511]217          "lastItemIsOpen": {
[510]218              "type": "object",
219              "properties": {
[511]220                  "subcode": { "$ref": "#/definitions/codeString" }
[510]221              },
[511]222              "required": ["subcode"],
[510]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": {
[511]237                "subcode": { "$ref": "#/definitions/codeString" },
238                "text": { "$ref": "#/definitions/nonEmptyString" }
[493]239              },
[506]240              "required": ["subcode","text"],
[493]241              "additionalProperties": false
[506]242          } },
[511]243          "lastItemIsOpen": {
[506]244              "type": "object",
245              "properties": {
[511]246                "subcode": { "$ref": "#/definitions/codeString" }
[506]247              },
[511]248              "required": ["subcode"],
[506]249              "additionalProperties": false
250          }
[493]251        },
252        "required":["type","items"],
253        "additionalProperties": false
[487]254      }
[479]255    }
256  }
257}
Note: See TracBrowser for help on using the repository browser.