Commit Graph

29 Commits (fdfbd4402a82ce63b220323794f64c51900d31d1)

Author SHA1 Message Date
Evgeny Poberezkin fdfbd4402a feat: support for required dependencies of custom keyword (keywords that must be present in the same schema) 2019-02-09 20:28:33 +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 9abe4e78a9 refactor: rename $data.js and $data.json without $, closes #526 2017-11-05 22:08:36 +00:00
Evgeny Poberezkin 80dddfda89 style: enable no-useless-escape rule 2017-07-06 22:03:30 +01: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
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 416f294350 Merge branch 'master' into 5.0.0 2016-12-23 19:47:01 +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 05f2416893 feat: support custom keywords that have implementations for other keywords 2016-12-11 17:42:08 +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 1c3762c0e8 fix: remove duplicated return from generated code, correct error message 2016-12-02 17:48:56 +00:00
Evgeny Poberezkin 84b900889f refactor: function to check that schema has no rules except one specified (e.g. $ref) 2016-08-07 11:05:27 +01:00
Evgeny Poberezkin 3185847572 feat: log warning if other keywords are used with "$ref", #260 2016-08-06 21:10:57 +01:00
Evgeny Poberezkin 5a80c7cff6
feat: support meta-schema validation in custom keywords with $data support, #146 2016-07-22 14:25:41 +01:00
Evgeny Poberezkin 7f5fe70cdb
feat: $data support in custom keywords, #146 2016-07-19 22:50:10 +01:00
Evgeny Poberezkin caf7557bc0
refactor: convert custom.def partial into custom.jst function (for better encapsulation) 2016-07-18 22:14:02 +01:00
Evgeny Poberezkin 1a6e4b576c
feat: meta schema for custom keywords schemas, closes #230 2016-07-17 11:20:47 +01:00
Evgeny Poberezkin 5c8e32dffc eslint: no-shadow, no-invalid-this 2016-02-04 22:24:59 +00:00
Evgeny Poberezkin 2eef59dede minified browser bundle 2015-12-27 21:33:07 +00:00
Evgeny Poberezkin 694e81684f throw exception if custom keyword is not an identifier; update tests as macro keyword definition supports type 2015-12-26 23:04:45 +00:00
Evgeny Poberezkin c4786866e2 simplify compiling macro keywords 2015-12-26 22:27:13 +00:00
Evgeny Poberezkin d7fd8229a9 time format; formatMaximum/formatMinimum and exclusiveFormatMaximum/exclusiveFormatMinimum keywords from v5 proposals 2015-12-05 21:16:28 +00:00
Evgeny Poberezkin 06fd23217a removed peerDependency, closes #78 2015-11-24 06:35:50 +00:00
Evgeny Poberezkin a6de2b8047 addKeyword to separate file, whitespace 2015-11-22 02:07:41 +00:00