{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "QED Object Schema", "version": "2", "type": "object", "oneOf": [ { "$ref": "#/definitions/schemaInfo" }, { "$ref": "#/definitions/docs/any" } ], "definitions": { "schemaInfo": { "type": "object", "properties": { "_id": { "type": "string", "pattern": "schemaInfo" }, "_rev": { "type": "string" }, "version": { "type": "string" } }, "required": ["_id","version"], "additionalProperties": false }, "docs": { "any": { "type": "object", "oneOf":[ { "$ref": "#/definitions/docs/Question" }, { "$ref": "#/definitions/docs/Survey" }, { "$ref": "#/definitions/docs/SurveyRun" }, { "$ref": "#/definitions/docs/Response" } ] }, "Question": { "type": "object", "properties": { "type": { "type": "string", "pattern": "Question" }, "_id": { "type": "string" }, "_rev": { "type": "string" }, "categories": { "type": "array", "items": { "type": "string" } }, "code": { "type": "string", "minLength": 1 }, "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } }, "description": { "type": "string" }, "publicationDate": { "type": "string", "format": "datetime" }, "title": { "type": "string" }, "topic": { "type": "string" } }, "required": ["type","categories","code","content","title"], "additionalProperties": false }, "Survey": { "type": "object", "properties": { "type": { "type": "string", "pattern": "Survey" }, "_id": { "type": "string" }, "_rev": { "type": "string" }, "description": { "type": "string" }, "publicationDate": { "type": "string", "format": "datetime" }, "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } }, "title": { "type": "string" } }, "required": ["type","questions","title"], "additionalProperties": false }, "SurveyRun": { "type": "object", "properties": { "type": { "type": "string", "pattern": "SurveyRun" }, "_id": { "type": "string" }, "_rev": { "type": "string" }, "description": { "type": "string" }, "endDate": { "type": "string", "format": "datetime" }, "liveName": { "type": "string" }, "mode": { "type": "string", "enum": [ "open", "closed" ] }, "respondentCanDeleteOwnResponse": { "type": "boolean" }, "secret": { "type": "string", "minLength": 1 }, "startDate": { "type": "string", "format": "datetime" }, "survey": { "$ref": "#/definitions/docs/Survey" }, "title": { "type": "string" } }, "required": ["type","description","mode","secret","survey","title"], "additionalProperties": false }, "Response": { "type": "object", "properties": { "type": { "type": "string", "pattern": "Response" }, "_id": { "type": "string" }, "_rev": { "type": "string" }, "answers": { "type": "object" }, "email": { "type": "string", "format": "email" }, "publicationDate": { "type": "string", "format": "datetime" }, "secret": { "type": "string", "minLength": 1 }, "surveyRunId": { "type": "string" } }, "required": ["type","answers","secret","surveyRunId"], "additionalProperties": false } }, "content":{ "any": { "type": "object", "oneOf": [ { "$ref": "#/definitions/content/Text" }, { "$ref": "#/definitions/content/StringInput" }, { "$ref": "#/definitions/content/ScaleInput" } ] }, "Text": { "type": "object", "properties": { "type": { "type": "string", "pattern": "Text" }, "text": { "type": "string" } }, "required": ["type","text"], "additionalProperties": false }, "StringInput": { "type": "object", "properties": { "type": { "type": "string", "pattern": "StringInput" }, "text": { "type": "string" } }, "required":["type","text"], "additionalProperties": false }, "ScaleInput": { "type": "object", "properties": { "type": { "type": "string", "pattern": "ScaleInput" }, "minLabel": { "type": "string" }, "min": { "type": "integer" }, "max": { "type": "integer" }, "maxLabel": { "type": "string" }, "naLabel": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string" }, "minLabel": { "type": "string" }, "maxLabel": { "type": "string" } }, "required":["text"], "additionalProperties": false } } }, "required":["type","min","max","items"], "additionalProperties": false } } } }