Changeset 487 for Dev/trunk/src/node_modules/tv4/README.md
- Timestamp:
- 03/05/14 22:44:48 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/node_modules/tv4/README.md
r484 r487 85 85 ## Cyclical JavaScript objects 86 86 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.87 While 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. 88 88 89 89 Consider this data, notice how both `a` and `b` refer to each other: … … 99 99 ``` 100 100 101 If the final checkRecursiveargument were missing, this would throw a "too much recursion" error.102 103 To enable supp rot for thispass `true` as additional argument to any of the regular validation methods:101 If the `checkRecursive` argument were missing, this would throw a "too much recursion" error. 102 103 To enable support for this, pass `true` as additional argument to any of the regular validation methods: 104 104 105 105 ```javascript 106 106 tv4.validate(a, aSchema, true); 107 tv4.validate(a, schema, asynchronousFunction, true);108 109 107 tv4.validateResult(data, aSchema, true); 110 108 tv4.validateMultiple(data, aSchema, true); 111 109 ``` 112 110 111 ## The `banUnknownProperties` flag 112 113 Sometimes, 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 115 As 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 118 tv4.validate(data, schema, checkRecursive, true); 119 tv4.validateResult(data, schema, checkRecursive, true); 120 tv4.validateMultiple(data, schema, checkRecursive, true); 121 ``` 122 113 123 ## API 114 124 … … 229 239 ##### addFormat(format, validationFunction) 230 240 231 Add a custom format validator. 241 Add a custom format validator. (There are no built-in format validators.) 232 242 233 243 * `format` is a string, corresponding to the `"format"` value in schemas.
Note: See TracChangeset
for help on using the changeset viewer.