Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking validity of keywords #781

Closed
erencay opened this issue May 3, 2018 · 2 comments
Closed

Checking validity of keywords #781

erencay opened this issue May 3, 2018 · 2 comments

Comments

@erencay
Copy link

erencay commented May 3, 2018

Currently ajv does not provide any option to check whatever the keywords you use are valid or not. Such option could be useful to reduce typos but more importantly ease the migration from other schema validation libraries and prevent using similar keywords used by other tools. (such as some orms where you might get used to use "max" instead of "maximum", or "allowedValues" instead of "enum")

It's a trivial task to check if a schema is valid or not, but since ajv already aware of valid keywords and can track custom ones I think having a such built-in feature would be nice.

@epoberezkin
Copy link
Member

Given the complexity of extending meta-schema in the specification, and also the fact that ajv doesn't require it for custom keywords (and instead accepts their "meta-schemas" as part of their definition), I think it can be useful to have an option unknownKeywords: 'ignore'(default)|'fail'|'log'} that would make Ajv throw exception or log in case any unknown keyword is used.

It should support (as known) all defined/reserved annotation keywords as well.

@epoberezkin
Copy link
Member

in 6.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants