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

Last change on this file since 492 was 492, checked in by hendrikvanantwerpen, 11 years ago
  • Enable/disable buttons on content change.
  • One place to do date formatting, because it was going wrong again.
  • Serialize questions in survey properly.
  • _ComplexValueMixin consumes submit events, but does trigger outer forms if present.
  • Trigger dialog show/hide for login only after previous effect is finished.
  • Check that documents are actually valid, not just that validator returned a result.
  • Validate email and timestamp formats.
  • Prepared for live runs.
File size: 5.2 KB
Line 
1{
2  "$schema": "http://json-schema.org/draft-04/schema#",
3  "title": "QED Object Schema",
4  "version": "2",
5  "type": "object",
6  "oneOf": [
7    { "$ref": "#/definitions/schemaInfo" },
8    { "$ref": "#/definitions/docs/any" }
9  ],
10  "definitions": {
11    "schemaInfo": {
12      "type": "object",
13      "properties": {
14          "_id": { "type": "string", "pattern": "schemaInfo" },
15          "_rev": { "type": "string" },
16          "version": { "type": "string" }
17      },
18      "required": ["_id","version"],
19      "additionalProperties": false
20    },
21    "docs": {
22      "any": {
23        "type": "object",
24        "oneOf":[
25          { "$ref": "#/definitions/docs/Question" },
26          { "$ref": "#/definitions/docs/Survey" },
27          { "$ref": "#/definitions/docs/SurveyRun" },
28          { "$ref": "#/definitions/docs/Response" }
29        ]
30      },
31      "Question": {
32        "type": "object",
33        "properties": {
34          "type": { "type": "string", "pattern": "Question" },
35          "_id": { "type": "string" },
36          "_rev": { "type": "string" },
37          "categories": { "type": "array", "items": { "type": "string" } },
38          "code": { "type": "string", "minLength": 1 },
39          "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } },
40          "description": { "type": "string" },
41          "publicationDate": { "type": "string", "format": "datetime" },
42          "title": { "type": "string" },
43          "topic": { "type": "string" }
44        },
45        "required": ["type","categories","code","content","title"],
46        "additionalProperties": false
47      },
48      "Survey": {
49        "type": "object",
50        "properties": {
51          "type": { "type": "string", "pattern": "Survey" },
52          "_id": { "type": "string" },
53          "_rev": { "type": "string" },
54          "description": { "type": "string" },
55          "publicationDate": { "type": "string", "format": "datetime" },
56          "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } },
57          "title": { "type": "string" }
58        },
59        "required": ["type","questions","title"],
60        "additionalProperties": false
61      },
62      "SurveyRun": {
63        "type": "object",
64        "properties": {
65          "type": { "type": "string", "pattern": "SurveyRun" },
66          "_id": { "type": "string" },
67          "_rev": { "type": "string" },
68          "description": { "type": "string" },
69          "endDate": { "type": "string", "format": "datetime" },
70          "liveName": { "type": "string" },
71          "mode": { "type": "string", "enum": [ "open", "closed" ] },
72          "respondentCanDeleteOwnResponse": { "type": "boolean" },
73          "secret": { "type": "string", "minLength": 1 },
74          "startDate": { "type": "string", "format": "datetime" },
75          "survey": { "$ref": "#/definitions/docs/Survey" },
76          "title": { "type": "string" }
77        },
78        "required": ["type","description","mode","secret","survey","title"],
79        "additionalProperties": false
80      },
81      "Response": {
82        "type": "object",
83        "properties": {
84          "type": { "type": "string", "pattern": "Response" },
85          "_id": { "type": "string" },
86          "_rev": { "type": "string" },
87          "answers": { "type": "object" },
88          "email": { "type": "string", "format": "email" },
89          "publicationDate": { "type": "string", "format": "datetime" },
90          "secret": { "type": "string", "minLength": 1 },
91          "surveyRunId": { "type": "string" }
92        },
93        "required": ["type","answers","secret","surveyRunId"],
94        "additionalProperties": false
95      }
96    },
97    "content":{
98      "any": {
99        "type": "object",
100        "oneOf": [
101          { "$ref": "#/definitions/content/Text" },
102          { "$ref": "#/definitions/content/StringInput" },
103          { "$ref": "#/definitions/content/ScaleInput" }
104        ]
105      },
106      "Text": {
107        "type": "object",
108        "properties": {
109          "type": { "type": "string", "pattern": "Text" },
110          "text": { "type": "string" }
111        },
112        "required": ["type","text"],
113        "additionalProperties": false
114      },
115      "StringInput": {
116        "type": "object",
117        "properties": {
118          "type": { "type": "string", "pattern": "StringInput" },
119          "text": { "type": "string" }
120        },
121        "required":["type","text"],
122        "additionalProperties": false
123      },
124      "ScaleInput": {
125        "type": "object",
126        "properties": {
127          "type": { "type": "string", "pattern": "ScaleInput" },
128          "minLabel": { "type": "string" },
129          "min": { "type": "integer" },
130          "max": { "type": "integer" },
131          "maxLabel": { "type": "string" },
132          "naLabel": { "type": "string" },
133          "items": { "type": "array", "items": {
134            "type": "object",
135            "properties": {
136              "text": { "type": "string" },
137              "minLabel": { "type": "string" },
138              "maxLabel": { "type": "string" }
139            },
140            "required":["text"],
141            "additionalProperties": false
142          } }
143        },
144        "required":["type","min","max","items"],
145        "additionalProperties": false
146      }
147    }
148  }
149}
Note: See TracBrowser for help on using the repository browser.