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
RevLine 
[479]1{
[487]2  "$schema": "http://json-schema.org/draft-04/schema#",
[479]3  "title": "QED Object Schema",
[487]4  "version": "2",
[480]5  "type": "object",
6  "oneOf": [
[487]7    { "$ref": "#/definitions/schemaInfo" },
8    { "$ref": "#/definitions/docs/any" }
[480]9  ],
[487]10  "definitions": {
11    "schemaInfo": {
[479]12      "type": "object",
13      "properties": {
[487]14          "_id": { "type": "string", "pattern": "schemaInfo" },
15          "_rev": { "type": "string" },
16          "version": { "type": "string" }
[479]17      },
[487]18      "required": ["_id","version"],
[479]19      "additionalProperties": false
20    },
[487]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        ]
[479]30      },
[487]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" } },
[492]38          "code": { "type": "string", "minLength": 1 },
[487]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
[479]47      },
[487]48      "Survey": {
49        "type": "object",
50        "properties": {
51          "type": { "type": "string", "pattern": "Survey" },
52          "_id": { "type": "string" },
53          "_rev": { "type": "string" },
[492]54          "description": { "type": "string" },
[487]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
[479]61      },
[487]62      "SurveyRun": {
[479]63        "type": "object",
64        "properties": {
[487]65          "type": { "type": "string", "pattern": "SurveyRun" },
66          "_id": { "type": "string" },
67          "_rev": { "type": "string" },
68          "description": { "type": "string" },
69          "endDate": { "type": "string", "format": "datetime" },
[492]70          "liveName": { "type": "string" },
[487]71          "mode": { "type": "string", "enum": [ "open", "closed" ] },
[492]72          "respondentCanDeleteOwnResponse": { "type": "boolean" },
73          "secret": { "type": "string", "minLength": 1 },
[487]74          "startDate": { "type": "string", "format": "datetime" },
75          "survey": { "$ref": "#/definitions/docs/Survey" },
76          "title": { "type": "string" }
[479]77        },
[487]78        "required": ["type","description","mode","secret","survey","title"],
[479]79        "additionalProperties": false
[487]80      },
81      "Response": {
[479]82        "type": "object",
83        "properties": {
[487]84          "type": { "type": "string", "pattern": "Response" },
85          "_id": { "type": "string" },
86          "_rev": { "type": "string" },
87          "answers": { "type": "object" },
[492]88          "email": { "type": "string", "format": "email" },
[487]89          "publicationDate": { "type": "string", "format": "datetime" },
[492]90          "secret": { "type": "string", "minLength": 1 },
[487]91          "surveyRunId": { "type": "string" }
[479]92        },
[487]93        "required": ["type","answers","secret","surveyRunId"],
[479]94        "additionalProperties": false
[487]95      }
[479]96    },
[487]97    "content":{
98      "any": {
[479]99        "type": "object",
[487]100        "oneOf": [
101          { "$ref": "#/definitions/content/Text" },
102          { "$ref": "#/definitions/content/StringInput" },
103          { "$ref": "#/definitions/content/ScaleInput" }
104        ]
105      },
106      "Text": {
107        "type": "object",
[479]108        "properties": {
[487]109          "type": { "type": "string", "pattern": "Text" },
110          "text": { "type": "string" }
[479]111        },
[487]112        "required": ["type","text"],
[479]113        "additionalProperties": false
[487]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      }
[479]147    }
148  }
149}
Note: See TracBrowser for help on using the repository browser.