Commit Graph

476 Commits (master)

Author SHA1 Message Date
Evgeny Poberezkin 81b810f421 test: update JSON-Schema-Test-Suite 2017-12-02 12:58:13 +00:00
Evgeny Poberezkin ce62f117ee feat: use only $id by default, closes #641 2017-12-02 12:32:45 +00:00
Evgeny Poberezkin b8d36fc0b0 fix: recursive ref to async sub-schema, closes #612 2017-12-02 10:24:27 +00:00
Evgeny Poberezkin e15f543dbd refactor: remove patternGroups keyword, #614 2017-11-26 10:11:55 +00:00
Evgeny Poberezkin 4687ed3465 docs: corrections 2017-11-25 20:23:52 +00:00
Evgeny Poberezkin 05e2b38d67 fix: "default" should work inside "then" and "else", closes #635 2017-11-24 22:33:28 +00:00
Evgeny Poberezkin 04d62ae67e Merge branch 'master' into beta 2017-11-24 21:18:06 +00:00
Philipp Thuerwaechter c9a6f995a9 Add method chaining to all add* and remove* methods
According to issue #625 this enables crazy things like
`new Ajv().addSchema(mySchema).validate(schema, data)`
2017-11-22 08:37:42 +01:00
Evgeny Poberezkin 89a80cabf8 check that console has log, warn and error methods as well 2017-11-20 20:10:57 +00:00
Meir Rotstein 5ba22a36aa remove Logger class, resolve logger object on Ajv ctor instead 2017-11-19 23:02:08 +02:00
Meir Rotstein e0c7eac50d create logger instance per Ajv instance 2017-11-19 17:40:44 +02:00
Meir Rotstein ceb552abd4 logger option tests 2017-11-19 11:37:27 +02:00
Meir Rotstein b0e28ee344 logger component tests 2017-11-19 11:23:56 +02:00
Evgeny Poberezkin dd884fe93d feat: option $comment, closes #609 2017-11-10 21:41:27 +00:00
Evgeny Poberezkin ceefaa2a05 refactor: remove nodent, use ajv-async bundle instead 2017-11-08 21:52:03 +00:00
Evgeny Poberezkin b6d927980b feat: draft-07 meta-schema 2017-11-05 22:02:43 +00:00
Evgeny Poberezkin c9548d2c74 refactor: remove compilation of async schemas to generator functions, closes #585 2017-11-05 21:14:31 +00:00
Brendan Abbott 27855e1b72 Fix logic error for non leap years and months, add more tests 2017-11-03 21:38:58 +10:00
Brendan Abbott 1d44f1451a Add leap year support for date-time/date formats in full mode 2017-11-03 21:38:58 +10:00
Evgeny Poberezkin 32b01a83d2 test: failing test for #612 2017-10-30 21:03:47 +00:00
Evgeny Poberezkin a68e9a7535 feat: improve oneOf error reporting, #573 2017-10-29 20:51:08 +00:00
Evgeny Poberezkin 2e95b0531f feat: "contains" and "uniqueItems" should be validated after type coercion, closes #611 2017-10-29 18:56:28 +00:00
Evgeny Poberezkin 5e17f9b4ee feat: faster uniqueItems when items are scalars of the same type, closes #608 2017-10-29 18:20:24 +00:00
Evgeny Poberezkin b4561767ff feat: if/then/else keyword, closes #586 2017-10-28 20:46:53 +01:00
Evgeny Poberezkin e6aa9e0855 feat: format json-pointer only means string now, added format json-pointer-uri-fragment, closes #589 2017-10-26 18:35:09 +01:00
Evgeny Poberezkin d20da89819 feat: formats time and date-time allow leap second, closes #594 2017-10-26 18:10:10 +01:00
Evgeny Poberezkin 75c95950a2 refactor: use fast-json-stable-stringify, closes #569, closes #579 2017-10-24 18:52:13 +01:00
Sondre Lefsaker cf8f9d38d0 fix: use uri-js to resovle uri's 2017-08-06 15:09:14 +02:00
Evgeny Poberezkin 6a2225b043 fix: same missing $ref used more then once throws exception with missingRefs: false, fixes #533 2017-07-10 15:46:50 +01:00
Evgeny Poberezkin 80dddfda89 style: enable no-useless-escape rule 2017-07-06 22:03:30 +01:00
Evgeny Poberezkin 0a1c57eede refactor: replace "equal" with package fast-deep-equal 2017-06-16 23:06:27 +01:00
Evgeny Poberezkin 0d6ae42c0f fix: traverse only schema objects, fixes #521 2017-06-15 21:35:09 +01:00
Evgeny Poberezkin 52e944b9fa fix: incorrect error reporting for exclusiveMaximum/Minimum, closes #506 2017-05-28 17:21:34 +01:00
Evgeny Poberezkin 297708866b fix: contains allows empty array when sibling property uses $ref in schema, closes #502 2017-05-25 21:25:39 +01:00
Evgeny Poberezkin 78ba5ef3b9 test: failing test for #502 (contains allows epty array when sibling property uses $ref in schema) 2017-05-25 21:06:19 +01:00
Evgeny Poberezkin 022a825362 test: additional tests to verify number of errors when type is used 2017-05-20 21:44:17 +01:00
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 92bfedab8d test: skipped test for error reporting with coerceTypes option, #469 2017-04-28 13:54:19 +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 3f9ab64490 feat: more comprehencive uri-reference format in {format: "full"} mode 2017-03-19 18:55:51 +00:00
Evgeny Poberezkin 0b308db57b test: update JSON-Schema-Test-Suite, enable optional/bignum test 2017-03-12 18:38:22 +00:00
Evgeny Poberezkin 54624b92f8 refactor: JSON-Schema-Test-Suite tests 2017-03-12 17:27:10 +00: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 4f631e61b8 feat: support $id, #384 2017-02-27 00:18:42 +00:00
Evgeny Poberezkin 917f20c5c3 test: draft-06 tests from JSON-Schema-Test-Suite 2017-02-26 19:35:26 +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 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 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 57fc360285 test: ownProperties option with properties and required keywords, #197 2017-02-11 23:23:48 +00:00
Evgeny Poberezkin ea5b7008ae fix: support ownProperties option with properties keyword, #197 2017-02-11 23:11:41 +00:00
Evgeny Poberezkin dbe863032a test: failing tests for ownProperties option (skipped), #197 2017-02-11 22:31:37 +00:00
Evgeny Poberezkin c9fb5cafb9 refactor: tests for ownProperties option, #197 2017-02-11 22:20:46 +00:00
Evgeny Poberezkin 6bf7d19ff2 test: number format via $data, #291 2017-02-10 21:59:20 +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 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 e7de15c60b Revert "test: remove invalid test cases"
This reverts commit af37a943cc.
2017-01-25 22:26:31 +00:00
Gajus Kuizinas 5a374ed7b7 test: correct test format 2017-01-25 20:30:26 +00:00
Gajus Kuizinas af37a943cc test: remove invalid test cases
These cases are not expected to pass using the current regex.
2017-01-25 20:19:16 +00:00
Gajus Kuizinas 625bed10d2 test: add test cases for URL format 2017-01-25 20:00:05 +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 8bb3b52f55 feat: serialize option, closes #385, closes #341 2017-01-21 20:28:50 +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 82002ec5e8 test: failing test for custom keyword mutating data, #141, #392 2017-01-20 20:26:14 +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 988fcfbbca test: numeric exclusiveMaximum/Minimum together with maximum/minimum, both as $data 2016-12-29 20:36:45 +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 6f2cea2244 refactor: support for transpile option moved to ajv-async package, #383 2016-12-26 20:57:14 +00:00
Evgeny Poberezkin c6d5c31ab4 style: convert eslintrc files to yml 2016-12-26 17:58:38 +00:00
Evgeny Poberezkin fc1c46cbfa feat: option processCode replaced option beautify, closes #382 2016-12-26 16:57:06 +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 5503fe3553 test: enable test that was failing 2016-12-25 00:28:59 +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 559efa2b49 feat: support dependencies keyword with empty array of required properties, #367 2016-12-24 16:21:34 +00:00