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

Last change on this file since 480 was 480, checked in by hendrikvanantwerpen, 11 years ago

Introduced schema version.

File size: 4.4 KB
Line 
1{
2  "title": "QED Object Schema",
3  "type": "object",
4  "oneOf": [
5    { "$ref": "#/schemaInfo" },
6    { "$ref": "#/docTypes/any" }
7  ],
8  "schemaInfo": {
9    "type": "object",
10    "properties": {
11        "_id": { "type": "string", "pattern": "schemaInfo" },
12        "_rev": { "type": "string", "optional": true },
13        "version": { "type": "string", "pattern": "1" }
14    },
15    "additionalProperties": false
16  },
17  "docTypes": {
18    "any": {
19      "type": "object",
20      "oneOf": [
21        { "$ref": "#/docTypes/Question" },
22        { "$ref": "#/docTypes/Survey" },
23        { "$ref": "#/docTypes/SurveyRun" },
24        { "$ref": "#/docTypes/Response" }
25      ]
26    },
27    "Question": {
28      "properties": {
29        "type": { "type": "string", "pattern": "Question" },
30        "_id": { "type": "string", "optional": true },
31        "_rev": { "type": "string", "optional": true },
32        "categories": { "type": "array", "items": { "type": "string" } },
33        "code": { "type": "string" },
34        "content": { "type": "array", "items": { "$ref": "#/contentTypes/any" } },
35        "description": { "type": "string", "optional": true },
36        "publicationDate": { "type": "string", "pattern": "", "optional": true },
37        "title": { "type": "string" },
38        "topic": { "type": "string", "optional": true }
39      },
40      "additionalProperties": false
41    },
42    "Survey": {
43      "type": "object",
44      "properties": {
45        "type": { "type": "string", "pattern": "Survey" },
46        "_id": { "type": "string", "optional": true },
47        "_rev": { "type": "string", "optional": true },
48        "publicationDate": { "type": "string", "pattern": "", "optional": true },
49        "questions": { "type": "array", "items": { "$ref": "#/docTypes/Question" } },
50        "title": { "type": "string" }
51      },
52      "additionalProperties": false
53    },
54    "SurveyRun": {
55      "type": "object",
56      "properties": {
57        "type": { "type": "string", "pattern": "SurveyRun" },
58        "_id": { "type": "string", "optional": true },
59        "_rev": { "type": "string", "optional": true },
60        "description": { "type": "string" },
61        "endDate": { "type": "string", "pattern": "" },
62        "mode": { "type": "string", "enum": [ "open", "closed" ] },
63        "startDate": { "type": "string", "pattern": "" },
64        "survey": { "$ref": "#/docTypes/Survey" },
65        "title": { "type": "string" }
66      },
67      "additionalProperties": false
68    },
69    "Response": {
70      "type": "object",
71      "properties": {
72        "type": { "type": "string", "pattern": "Response" },
73        "_id": { "type": "string", "optional": true },
74        "_rev": { "type": "string", "optional": true },
75        "answers": { "type": "object" },
76        "publicationDate": { "type": "string", "pattern": "", "optional": true },
77        "surveyRunId": { "type": "string" }
78      },
79      "additionalProperties": false
80    }
81  },
82  "contentTypes": {
83    "any": {
84      "type": "object",
85      "oneOf": [
86        { "$ref": "#/contentTypes/Text" },
87        { "$ref": "#/contentTypes/StringInput" },
88        { "$ref": "#/contentTypes/ScaleInput" }
89      ]
90    },
91    "Text": {
92        "type": "object",
93        "properties": {
94            "type": { "type": "string", "pattern": "Text" },
95            "text": { "type": "string" }
96        },
97        "additionalProperties": false
98    },
99    "StringInput": {
100        "type": "object",
101        "properties": {
102            "type": { "type": "string", "pattern": "StringInput" },
103            "text": { "type": "string" }
104        },
105        "additionalProperties": false
106    },
107    "ScaleInput": {
108        "type": "object",
109        "properties": {
110            "type": { "type": "string", "pattern": "ScaleInput" },
111            "minLabel": { "type": "string", "optional": true },
112            "min": { "type": "integer" },
113            "max": { "type": "integer" },
114            "maxLabel": { "type": "string", "optional": true },
115            "naLabel": { "type": "string", "optional": true },
116            "items": { "type": "array", "items": {
117                "type": "object",
118                "properties": {
119                    "text": { "type": "string" },
120                    "minLabel": { "type": "string", "optional": true },
121                    "maxLabel": { "type": "string", "optional": true }
122                },
123                "additionalProperties": false
124            } }
125        },
126        "additionalProperties": false
127    }
128  }
129}
Note: See TracBrowser for help on using the repository browser.