Ignore:
Timestamp:
03/11/14 22:45:58 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Added subcodes to schema and config widgets.
  • Disallow empty strings in schema and strip objects before sending them to the server.
  • Finally managed proper change events in lists and complexvalues.
Location:
Dev/trunk/src/server/config
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/server/config/couchdb-design-docs.js

    r501 r506  
    1111
    1212    "qed/schemaInfo": {
    13         version: "2"
     13        version: "3"
    1414    },
    1515
  • Dev/trunk/src/server/config/couchdb-schema.json

    r499 r506  
    22  "$schema": "http://json-schema.org/draft-04/schema#",
    33  "title": "QED Object Schema",
    4   "version": "2",
     4  "version": "3",
    55  "type": "object",
    66  "oneOf": [
     
    99  ],
    1010  "definitions": {
     11    "nonEmptyString": { "type": "string", "minLength": 1 },
    1112    "schemaInfo": {
    1213      "type": "object",
    1314      "properties": {
    1415          "_id": { "type": "string", "pattern": "^schemaInfo$" },
    15           "_rev": { "type": "string" },
    16           "version": { "type": "string" }
     16          "_rev": { "$ref": "#/definitions/nonEmptyString" },
     17          "version": { "$ref": "#/definitions/nonEmptyString" }
    1718      },
    1819      "required": ["_id","version"],
     
    3334        "properties": {
    3435          "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 },
     36          "_id": { "$ref": "#/definitions/nonEmptyString" },
     37          "_rev": { "$ref": "#/definitions/nonEmptyString" },
     38          "categories": { "type": "array", "items": { "$ref": "#/definitions/nonEmptyString" } },
     39          "code": { "$ref": "#/definitions/nonEmptyString" },
    3940          "content": { "type": "array", "items": { "$ref": "#/definitions/content/any" } },
    40           "description": { "type": "string" },
     41          "description": { "$ref": "#/definitions/nonEmptyString" },
    4142          "publicationDate": { "type": "string", "format": "datetime" },
    42           "title": { "type": "string" },
    43           "topic": { "type": "string" }
     43          "title": { "$ref": "#/definitions/nonEmptyString" },
     44          "topic": { "$ref": "#/definitions/nonEmptyString" }
    4445        },
    4546        "required": ["type","categories","code","content","title"],
     
    5051        "properties": {
    5152          "type": { "type": "string", "pattern": "^Survey$" },
    52           "_id": { "type": "string" },
    53           "_rev": { "type": "string" },
    54           "description": { "type": "string" },
     53          "_id": { "$ref": "#/definitions/nonEmptyString" },
     54          "_rev": { "$ref": "#/definitions/nonEmptyString" },
     55          "description": { "$ref": "#/definitions/nonEmptyString" },
    5556          "publicationDate": { "type": "string", "format": "datetime" },
    5657          "questions": { "type": "array", "items": { "$ref": "#/definitions/docs/Question" } },
    57           "title": { "type": "string" }
     58          "title": { "$ref": "#/definitions/nonEmptyString" }
    5859        },
    5960        "required": ["type","questions","title"],
     
    6465        "properties": {
    6566          "type": { "type": "string", "pattern": "^SurveyRun$" },
    66           "_id": { "type": "string" },
    67           "_rev": { "type": "string" },
    68           "description": { "type": "string" },
     67          "_id": { "$ref": "#/definitions/nonEmptyString" },
     68          "_rev": { "$ref": "#/definitions/nonEmptyString" },
     69          "description": { "$ref": "#/definitions/nonEmptyString" },
    6970          "endDate": { "type": "string", "format": "datetime" },
    70           "liveName": { "type": "string" },
     71          "liveName": { "$ref": "#/definitions/nonEmptyString" },
    7172          "mode": { "type": "string", "enum": [ "open", "closed" ] },
    7273          "respondentCanDeleteOwnResponse": { "type": "boolean" },
    73           "secret": { "type": "string", "minLength": 1 },
     74          "secret": { "$ref": "#/definitions/nonEmptyString" },
    7475          "startDate": { "type": "string", "format": "datetime" },
    7576          "survey": { "$ref": "#/definitions/docs/Survey" },
    76           "title": { "type": "string" }
    77         },
    78         "required": ["type","description","mode","secret","survey","title"],
     77          "title": { "$ref": "#/definitions/nonEmptyString" }
     78        },
     79        "required": ["type","mode","secret","survey","title"],
    7980        "additionalProperties": false
    8081      },
     
    8384        "properties": {
    8485          "type": { "type": "string", "pattern": "^Response$" },
    85           "_id": { "type": "string" },
    86           "_rev": { "type": "string" },
     86          "_id": { "$ref": "#/definitions/nonEmptyString" },
     87          "_rev": { "$ref": "#/definitions/nonEmptyString" },
    8788          "answers": { "type": "object" },
    8889          "email": { "type": "string", "format": "email" },
    8990          "publicationDate": { "type": "string", "format": "datetime" },
    90           "secret": { "type": "string", "minLength": 1 },
    91           "surveyRunId": { "type": "string" }
     91          "secret": { "$ref": "#/definitions/nonEmptyString" },
     92          "surveyRunId": { "$ref": "#/definitions/nonEmptyString" }
    9293        },
    9394        "required": ["type","answers","secret","surveyRunId"],
     
    9596      }
    9697    },
    97     "content":{
     98    "content": {
    9899      "any": {
    99100        "type": "object",
     
    113114        "properties": {
    114115          "type": { "type": "string", "pattern": "^Header$" },
    115           "text": { "type": "string" }
     116          "text": { "$ref": "#/definitions/nonEmptyString" }
    116117        },
    117118        "required": ["type","text"],
     
    122123        "properties": {
    123124          "type": { "type": "string", "pattern": "^Text$" },
    124           "text": { "type": "string" }
     125          "text": { "$ref": "#/definitions/nonEmptyString" }
    125126        },
    126127        "required": ["type","text"],
     
    138139        "properties": {
    139140          "type": { "type": "string", "pattern": "^StringInput$" },
    140           "text": { "type": "string" }
    141         },
    142         "required":["type","text"],
     141          "subcode": { "$ref": "#/definitions/nonEmptyString" },
     142          "text": { "$ref": "#/definitions/nonEmptyString" }
     143        },
     144        "required":["type","subcode"],
    143145        "additionalProperties": false
    144146      },
     
    148150          "type": { "type": "string", "pattern": "^TextInput$" },
    149151          "maxLength": { "type": "integer" },
    150           "text": { "type": "string" }
    151         },
    152         "required":["type","text"],
     152          "subcode": { "$ref": "#/definitions/nonEmptyString" },
     153          "text": { "$ref": "#/definitions/nonEmptyString" }
     154        },
     155        "required":["type","subcode"],
    153156        "additionalProperties": false
    154157      },
     
    160163          "max": { "type": "integer" },
    161164          "places": { "type": "integer" },
    162           "text": { "type": "string" }
    163         },
    164         "required":["type","text"],
     165          "subcode": { "$ref": "#/definitions/nonEmptyString" },
     166          "text": { "$ref": "#/definitions/nonEmptyString" }
     167        },
     168        "required":["type","subcode"],
    165169        "additionalProperties": false
    166170      },
     
    169173        "properties": {
    170174          "type": { "type": "string", "pattern": "^ScaleInput$" },
    171           "minLabel": { "type": "string" },
     175          "minLabel": { "$ref": "#/definitions/nonEmptyString" },
    172176          "min": { "type": "integer" },
    173177          "max": { "type": "integer" },
    174           "maxLabel": { "type": "string" },
    175           "naLabel": { "type": "string" },
     178          "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
     179          "naLabel": { "$ref": "#/definitions/nonEmptyString" },
    176180          "items": { "type": "array", "items": {
    177181            "type": "object",
    178182            "properties": {
    179               "text": { "type": "string" },
    180               "minLabel": { "type": "string" },
    181               "maxLabel": { "type": "string" }
     183              "minLabel": { "$ref": "#/definitions/nonEmptyString" },
     184              "maxLabel": { "$ref": "#/definitions/nonEmptyString" },
     185              "subcode": { "$ref": "#/definitions/nonEmptyString" },
     186              "text": { "$ref": "#/definitions/nonEmptyString" }
    182187            },
    183             "required":["text"],
     188            "required":["subcode","text"],
    184189            "additionalProperties": false
    185190          } }
     
    196201              "type": "object",
    197202              "properties": {
    198                   "text": { "type": "string" }
     203                  "subcode": { "$ref": "#/definitions/nonEmptyString" },
     204                  "text": { "$ref": "#/definitions/nonEmptyString" }
    199205              },
    200               "required": ["text"],
     206              "required": ["subcode","text"],
    201207              "additionalProperties": false
    202           } }
     208          } },
     209          "otherItem": {
     210              "type": "object",
     211              "properties": {
     212                  "subcode": { "$ref": "#/definitions/nonEmptyString" },
     213                  "text": { "$ref": "#/definitions/nonEmptyString" }
     214              },
     215              "required": ["subcode","text"],
     216              "additionalProperties": false
     217          }
    203218        },
    204219        "required":["type","items"],
Note: See TracChangeset for help on using the changeset viewer.