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

Add keywords to Ajv options #1137

Merged

Conversation

franciscomorais
Copy link
Contributor

This PR adds the keywords option to the Ajv options to add custom keywords, without having to call addKeyword.

What issue does this pull request resolve?
#1136

What changes did you make?
Add the keywords option to the Ajv options to add custom keywords, without having to call addKeyword.

Is there anything that requires more attention while reviewing?
No

Copy link
Member

@epoberezkin epoberezkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment it adds formats, not keywords. The implementation, tests and types need to be updated.

@franciscomorais franciscomorais force-pushed the feature/keywords-options branch 2 times, most recently from 0101e15 to aa3123f Compare February 13, 2020 15:14
describe('keywords', function() {
it('should add keywords from options', function() {
var ajv = new Ajv({ keywords: {
identifier: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding type: "string" in the keyword definition and changing the implementation to /^[a-z_$][a-z0-9_$]*$/i.test(data) so the example makes sense. Then the same tests can be used as in formats option test.

@epoberezkin epoberezkin merged commit c90c189 into ajv-validator:master Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants