Ignore:
Timestamp:
03/05/14 22:44:48 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Completed migration to API, without CouchDB proxy.

Move to API is now completed. The full API is password protected, a very
limited API is exposed for respondents, which works with secrets that
are passed in URLs.

Serverside the HTTPResult class was introduced, which is similar to
Promises, but specifically for HTTP. It carries a status code and
response and makes it easier to extract parts of async handling in
separate functions.

Fixed a bug in our schema (it seems optional attributes don't exist but
a required list does). Verification of our schema by grunt-tv4 didn't
work yet. Our schema is organized the wrong way (this is fixable),
but the json-schema schema has problems with simple types and $refs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/node_modules/tv4/README.md

    r484 r487  
    8585## Cyclical JavaScript objects
    8686
    87 While they don't occur in proper JSON, JavaScript does support self-referencing objects. Any of the above calls support an optional final argument, checkRecursive. If true, tv4 will handle self-referencing objects properly - this slows down validation slightly, but that's better than a hanging script.
     87While they don't occur in proper JSON, JavaScript does support self-referencing objects. Any of the above calls support an optional third argument: `checkRecursive`. If true, tv4 will handle self-referencing objects properly - this slows down validation slightly, but that's better than a hanging script.
    8888
    8989Consider this data, notice how both `a` and `b` refer to each other:
     
    9999```
    100100
    101 If the final checkRecursive argument were missing, this would throw a "too much recursion" error.
    102 
    103 To enable supprot for this pass `true` as additional argument to any of the regular validation methods:
     101If the `checkRecursive` argument were missing, this would throw a "too much recursion" error.
     102
     103To enable support for this, pass `true` as additional argument to any of the regular validation methods:
    104104
    105105```javascript
    106106tv4.validate(a, aSchema, true);
    107 tv4.validate(a, schema, asynchronousFunction, true);
    108 
    109107tv4.validateResult(data, aSchema, true);
    110108tv4.validateMultiple(data, aSchema, true);
    111109```
    112110
     111## The `banUnknownProperties` flag
     112
     113Sometimes, it is desirable to flag all unknown properties as an error.  This is especially useful during development, to catch typos and the like, even when extra custom-defined properties are allowed.
     114
     115As such, tv4 implements ["ban unknown properties" mode](https://github.com/json-schema/json-schema/wiki/ban-unknown-properties-mode-\(v5-proposal\)), enabled by a fourth-argument flag:
     116
     117```javascript
     118tv4.validate(data, schema, checkRecursive, true);
     119tv4.validateResult(data, schema, checkRecursive, true);
     120tv4.validateMultiple(data, schema, checkRecursive, true);
     121```
     122
    113123## API
    114124
     
    229239##### addFormat(format, validationFunction)
    230240
    231 Add a custom format validator.
     241Add a custom format validator. (There are no built-in format validators.)
    232242
    233243* `format` is a string, corresponding to the `"format"` value in schemas.
Note: See TracChangeset for help on using the changeset viewer.