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

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

Hide database details behind decent API. Client needs to start using it now.

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