Skip to content

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
@franciscomorais franciscomorais force-pushed the feature/keywords-options branch from aa3123f to c5ac6ce Compare February 13, 2020 15:20
describe('keywords', function() {
it('should add keywords from options', function() {
var ajv = new Ajv({ keywords: {
identifier: {
Copy link
Member

@epoberezkin epoberezkin Feb 16, 2020

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.

@franciscomorais franciscomorais force-pushed the feature/keywords-options branch from c5ac6ce to 38191c2 Compare February 19, 2020 15:36
@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.

2 participants