Commit Graph

232 Commits (cad76056b9e3cc652552cdf2a83a745311f7b458)

Author SHA1 Message Date
Evgeny Poberezkin cad76056b9 Revert "refactor: make sure "type": "integer" is vaildated before other keywords, closes #485"
This reverts commit a02b9a6eed.
2017-05-20 21:37:39 +01:00
Evgeny Poberezkin 58a22728ab fix: incorrect integer validation, closes #490 2017-05-14 23:29:18 +01:00
Evgeny Poberezkin a02b9a6eed refactor: make sure "type": "integer" is vaildated before other keywords, closes #485 2017-05-13 23:42:41 +01:00
Evgeny Poberezkin f60fedb4e9 feat: validate types before other keywords, #485 2017-05-13 23:25:44 +01:00
Evgeny Poberezkin 3aa523e9f1 Merge branch 'v4' 2017-04-28 20:09:37 +01:00
Evgeny Poberezkin 4ed756ecac fix: duplicate "type" error is reported with coerceTypes option, fixes #469 2017-04-28 19:34:42 +01:00
Evgeny Poberezkin e82b62db23 Merge branch 'master' into 5.0.0 2017-04-08 20:04:28 +01:00
Evgeny Poberezkin 903cd73d01 refactor: remove OR branches that are always falsy 2017-04-07 23:26:25 +01:00
Evgeny Poberezkin d9ee511681 fix: modifying custom keyword should not update parent data of root data 2017-03-25 16:07:13 +00:00
Evgeny Poberezkin b99b93b6a5 fix: error params for contains keyword (typo) 2017-03-12 12:42:13 +00:00
Evgeny Poberezkin 4f631e61b8 feat: support $id, #384 2017-02-27 00:18:42 +00:00
Evgeny Poberezkin 376cc172b4 feat: extendRefs: "ignore" by default 2017-02-25 21:43:55 +00:00
Evgeny Poberezkin 3c86da4f1b fix: improve error reporting from oneOf keyword, closes #427 2017-02-25 21:16:55 +00:00
Evgeny Poberezkin 761aac1b5d refactor: optimize validation of additional/patternProperties and propertyNames with option ownProperties, closes #197 2017-02-12 18:31:40 +00:00
Evgeny Poberezkin 16bf5946fe fix: support required with $data/many properties with ownProperties option, #197 2017-02-12 17:58:18 +00:00
Evgeny Poberezkin 176ed87c33 fix: support schema dependencies with ownProperties option, #197 2017-02-12 00:36:14 +00:00
Evgeny Poberezkin 647cd6eccb Merge branch 'master' into 5.0.0 2017-02-12 00:26:33 +00:00
Evgeny Poberezkin 8413890875 fix: schema "dependencies" with property containing single quotes, closes #413 2017-02-12 00:21:53 +00:00
Evgeny Poberezkin 1babc9df49 fix: support property dependecies with ownProperties option, #197 2017-02-12 00:02:56 +00:00
Evgeny Poberezkin df6ef691ae fix: ownProperties option with required keyword, #197 2017-02-11 23:44:59 +00:00
Evgeny Poberezkin ea5b7008ae fix: support ownProperties option with properties keyword, #197 2017-02-11 23:11:41 +00:00
Evgeny Poberezkin 901343c95d feat: support formats with $data for numbers, #291 2017-02-10 21:52:51 +00:00
Evgeny Poberezkin c21cbee56f fix: support multiple types for format, #291 2017-02-10 20:53:13 +00:00
Evgeny Poberezkin 1d84987baa Merge ssh://github.com/nimerritt/ajv into nimerritt-master 2017-02-10 19:59:27 +00:00
Evgeny Poberezkin 03b24c72f8 fix: custom keywords with $data option validate as valid if their value (in data) is undefined 2017-02-05 17:40:39 +00:00
Evgeny Poberezkin d4fb50bdbe Merge branch 'master' into 5.0.0 2017-01-21 19:57:38 +00:00
Evgeny Poberezkin ccc9907d26 feat: allow setting dataPath in validate/compile keywords, closes #331 2017-01-21 19:44:08 +00:00
Evgeny Poberezkin a06327eab4 Merge branch 'master' into 5.0.0 2017-01-20 23:30:54 +00:00
Evgeny Poberezkin aa8de572df feat: custom keywords with predefined validation result, #393 2017-01-20 23:08:52 +00:00
Evgeny Poberezkin 33845cc397 feat: support custom keywords that modify data, #392 2017-01-20 22:03:36 +00:00
Evgeny Poberezkin 2468bd5014 refactor: custom keyword code generation, #392 2017-01-20 21:33:34 +00:00
Evgeny Poberezkin b2d641f244 feat: add schema id (URI) as a comment to generated code 2017-01-07 12:49:48 +00:00
Richard Taylor b1b0c553d8 Improve implementation of allowing hyphens in keywords
This:
- Updates the README with the new rules (and recommendations)
- Updates `keyword.js` to implement the agreed change to the naming rules:
- - Now same as before but also allow hyphens as second and subsequent characters
- Update tests to test the new keyword naming rules
- Update `definitions.def` to use it.util.getProperty() to dynamically choose dot
  or bracket notation as appropriate rather than hardcode bracket notation.

Test Plan:
- Run `npm test` and ensure all tests run and pass
2017-01-05 18:28:28 +00:00
Richard Taylor 66db560ca5 Allow custom keywords that are not valid JS identifiers
Custom keywords were required to be valid JS identifiers due to the
way they were being used in the generated code.  This prevented the use
of keywords with the `x-` prefix that is required by [swagger](http://swagger.io].

This change fixes that by updating the only place that was using them
directly as an identifier to use //brackets// notation rather than
//dot// notation.  This brings the definition of `$schemaPath` in
`definitions.def` in line with the way the rule definition is accessed
from `RULES.custom` at the top of `custom.jst`.

The validation of the keyword name has been changed to allow any name
in this change, but this should be updated to either just remove the
test or update it to a new rule before this change is included in
the project.

Finally, this also updates a number of the tests in `custom.spec.js` to
use non-valid identifiers for the names of some of the custom keywords
being tested (primarily by adding `x-` to the front of the name).

Test Plan:
- Run `npm test` and ensure all tests run and pass
2017-01-05 10:48:12 +00:00
Evgeny Poberezkin 41ecdaff7c refactor: contains implemented as a standard keyword, #367 2016-12-30 17:44:18 +00:00
Evgeny Poberezkin 19512861d2 feat: support numeric exclusiveMaximum/Minimum with $data, #367 2016-12-29 19:44:08 +00:00
Evgeny Poberezkin 4a9d765e5a feat: support numeric exclusiveMaximum/Minimum (no $data support yet), #367 2016-12-28 23:08:25 +00:00
Evgeny Poberezkin 1c284933fc feat: use co-wrapped generator function as default async option (async: co*), #383 2016-12-26 21:10:46 +00:00
Evgeny Poberezkin 6036f3ff07 feat: update type definitions
allow boolean schemas
async validation promise resolves with data
properties of custom keyword definition ($data and metaSchema)
custom keyword schema can be any value
keyword schema in error object can be any value
optional propertyName property of error object for all keywords (added when validating schema in propertyNames)
propertyNames keyword error params
2016-12-25 21:39:36 +00:00
Evgeny Poberezkin ad7ae50c51 refactor: move const keyword to rules (as standard keyword) 2016-12-25 20:42:54 +00:00
Evgeny Poberezkin 850b50523c feat: async validation promise resolves with data in case of success, closes #377 2016-12-25 20:24:36 +00:00
Evgeny Poberezkin f1028c8411 feat: support boolean schemas in $ref 2016-12-25 17:43:26 +00:00
Evgeny Poberezkin 225ef67ce5 refactor: omptimise/fix generated code
optimize code for schemas without validation keywords
fix bug in determining empty schema
2016-12-25 15:32:53 +00:00
Evgeny Poberezkin 71c3709c2a refactor: validate.jst 2016-12-25 14:09:11 +00:00
Evgeny Poberezkin 393b6a5b35 refactor: optimise code generated for boolean schemas 2016-12-25 13:53:51 +00:00
Evgeny Poberezkin a414a74fe0 Merge branch 'boolean-schemas' into 5.0.0 2016-12-25 13:33:37 +00:00
Evgeny Poberezkin ac6097f285 Merge branch 'master' into 5.0.0 2016-12-25 00:22:01 +00:00
Evgeny Poberezkin c4335abf53 fix: allOf with empty schemas failing compilation, fixes #381 2016-12-24 23:42:36 +00:00
Evgeny Poberezkin 484df70eb5 feat: support boolean schemas, #367 2016-12-24 23:04:07 +00:00
Evgeny Poberezkin a6f9cbda0f feat: boolean schemas 2016-12-24 21:23:31 +00:00