Commit Graph

553 Commits (4687ed3465faf881b1e9b4308014646c3d10acd0)

Author SHA1 Message Date
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 8bb21ddd21 Merge branch 'feat/add-url-record-format' of https://github.com/gajus/ajv into gajus-feat/add-url-record-format 2017-04-08 18:29:39 +01:00
Evgeny Poberezkin 903cd73d01 refactor: remove OR branches that are always falsy 2017-04-07 23:26:25 +01:00
Evgeny Poberezkin 8c0395908c feat: type definitions for options extendRefs and sourceCode 2017-03-26 19:32:21 +01:00
Evgeny Poberezkin 3b0eee33ca Merge branch 'master' into 5.0.0 2017-03-25 22:47:32 +00: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 3f9ab64490 feat: more comprehencive uri-reference format in {format: "full"} mode 2017-03-19 18:55:51 +00:00
Jonas Finnemann Jensen 1dbba47e7d Streamline regex for 'hostname' with 'email'
Changes:
 * HOSTNAME contained a capturing group
 * Reordered `[0-9a-z]` to `[a-z0-9]` (similar to what is used in the `email` pattern)
 * Removed two superfluous optional non-capturing groups: `(?:[a-z0-9-]{0,61})?` to `[a-z0-9-]{0,61}`
2017-03-17 20:23:07 -07:00
Evgeny Poberezkin cbef7f3061 refactor: update draft-06 meta-schema, fix URI resolution, fix tests 2017-03-12 17:10:16 +00:00
Evgeny Poberezkin 83bdcb1508 fix: uri-ref -> uri-reference 2017-03-12 12:55:47 +00:00
Evgeny Poberezkin b99b93b6a5 fix: error params for contains keyword (typo) 2017-03-12 12:42:13 +00:00
Evgeny Poberezkin da4277b01e Merge branch 'master' into 5.0.0 2017-02-28 19:59:51 +00:00
Evgeny Poberezkin 64aa3f3909 docs: type definition for schemaId option 2017-02-27 20:00:33 +00:00
Evgeny Poberezkin 4f631e61b8 feat: support $id, #384 2017-02-27 00:18:42 +00:00
Evgeny Poberezkin ac27a2473d feat: uri should be absolute, relative uri-ref is not valid uri 2017-02-25 22:35:36 +00:00
Evgeny Poberezkin 08e87c1f30 feat: format "regex" should fail if regular expression contains \Z anchor 2017-02-25 21:56:16 +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
Donald Pipowitch 6cc12130da Update ajv.d.ts 2017-02-21 14:55:57 +01: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 f4f80784b4 feat: add meta-schema for $data reference with options {meta: false, $data: true} 2017-02-10 18:40:07 +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 de0c827dec feat: throw exception if schema id is not a string and report error, closes #380 2017-02-04 22:36:21 +00:00
Evgeny Poberezkin f5bcd5735a fix: code clean-up, closes #388 2017-02-04 22:15:23 +00:00
Evgeny Poberezkin ca6916385b feat: throw exception if $schema is not a string, closes #394 2017-02-04 21:30:26 +00:00
Gajus Kuizinas 3588e453fa docs: document a better regex variation 2017-01-25 22:51:55 +00:00
Gajus Kuizinas 452d2408af fix: improve regex to pass all the tests 2017-01-25 22:51:33 +00:00
Gajus Kuizinas 8d232d2bb0 feat: add URL record format 2017-01-25 13:24:47 +00:00
Evgeny Poberezkin 254c2672d5 feat: format uri-template, #384 2017-01-23 22:08:05 +00:00
Evgeny Poberezkin e949b8462c test: patternGroups with meta; meta: false warns insead of throwing meta-schema validation 2017-01-23 20:16:38 +00:00
Evgeny Poberezkin 8892f98a4c fix: patternGroups without draft-06 meta-schema 2017-01-23 19:58:02 +00:00
Evgeny Poberezkin 8bb3b52f55 feat: serialize option, closes #385, closes #341 2017-01-21 20:28:50 +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 f89a04de4c docs: fixed custom keyword definition typing 2017-01-20 23:39:27 +00:00
Evgeny Poberezkin a06327eab4 Merge branch 'master' into 5.0.0 2017-01-20 23:30:54 +00:00
Evgeny Poberezkin 7148ae3607 docs: update typings for "modifying" and "valid" custom keywords, #392, #393 2017-01-20 23:25:45 +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 cf3f1cea50 refactor: changed format "uriref" to "uri-ref", #367 2016-12-29 23:05:28 +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 6f2cea2244 refactor: support for transpile option moved to ajv-async package, #383 2016-12-26 20:57:14 +00:00
Evgeny Poberezkin fc1c46cbfa feat: option processCode replaced option beautify, closes #382 2016-12-26 16:57:06 +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
Evgeny Poberezkin 559efa2b49 feat: support dependencies keyword with empty array of required properties, #367 2016-12-24 16:21:34 +00:00
Evgeny Poberezkin 17de8aba47 fix: error macro 2016-12-24 02:23:12 +00:00
Evgeny Poberezkin 82775ee8de feat: draft6 propertyName keyword (standard, inline) 2016-12-23 23:45:48 +00:00
Evgeny Poberezkin d41d150ba3 Merge branch 'master' into 5.0.0 2016-12-23 22:18:36 +00:00
Evgeny Poberezkin c02a3bdc48 refactor: clean up keyword templates 2016-12-23 22:02:41 +00:00
Evgeny Poberezkin 416f294350 Merge branch 'master' into 5.0.0 2016-12-23 19:47:01 +00:00
Evgeny Poberezkin 23f2572d1c fix: formats json-pointer and relative-json-pointer now support empty fragments 2016-12-23 17:34:25 +00:00
Evgeny Poberezkin 9f487e2833 refactor: rename keyword "constant" to "const", #367 2016-12-21 21:50:10 +00:00
Evgeny Poberezkin ab488a4f57 feat: option $data instead of v5, use draft-6 meta schema, support constant and contains keywords by default, #372 2016-12-21 21:11:59 +00:00
Evgeny Poberezkin 42d640779a refactor: move patternGroups deprecation message to schema compilation, #371 2016-12-20 20:57:34 +00:00
Evgeny Poberezkin 73593ac04e refactor: remove keywords moved to ajv-keywords from v5 meta-schema, #371 2016-12-20 20:48:11 +00:00
Evgeny Poberezkin afd02f1f72 refactor: patternGroups deprecated, requires option to use, #371 2016-12-20 20:33:51 +00:00
Evgeny Poberezkin d19bc92c8b refactor: move format comparison functions to ajv-keywords, #371 2016-12-11 18:49:02 +00:00
Evgeny Poberezkin 05f2416893 feat: support custom keywords that have implementations for other keywords 2016-12-11 17:42:08 +00:00
Evgeny Poberezkin a607d4f422 refactor: generic management of keywords implemented in other keywords (additionalProperties, patternProperties) 2016-12-11 16:22:02 +00:00
Evgeny Poberezkin 8a470f32df docs: getKeyword, removeKeywords methods 2016-12-11 12:38:13 +00:00
Evgeny Poberezkin 7bfc868816 test: getKeyword, removeKeyword methods 2016-12-11 12:12:27 +00:00
Evgeny Poberezkin 506370804a feat: get and remove custom keywords from the Ajv instance, related to #371 2016-12-11 11:17:37 +00:00
Evgeny Poberezkin f3577a3b34 refactor: moved switch, patternRequired, formatMinimum/Maximum to ajv-keywords, #371 2016-12-10 22:00:42 +00:00
Evgeny Poberezkin 34b0101eb6 Merge branch 'master' into 5.0.0 2016-12-10 20:45:08 +00:00
Evgeny Poberezkin 5081be2720 refactor: make variable for package names local, closes #325, #117 2016-12-06 21:29:02 +00:00
Minchenko Valery 06fdf7175e Store require paths for optional dependencies in variables
remove warnings about missing dpendencies for webpack
2016-12-06 16:44:11 +03:00
Evgeny Poberezkin 1c3762c0e8 fix: remove duplicated return from generated code, correct error message 2016-12-02 17:48:56 +00:00
Evgeny Poberezkin 547b44013d Merge branch 'domoritz-patch-1' into 5.0.0 2016-11-30 21:03:25 +00:00
Evgeny Poberezkin eb8353ce6a Merge branch 'master' into 5.0.0 2016-11-30 20:50:56 +00:00
Evgeny Poberezkin 445acb5afd style: single quotes 2016-11-30 20:25:39 +00:00
Dominik Moritz 14cd94d3cf Update types for options from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/ajv/index.d.ts 2016-11-29 19:53:52 -08:00