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

Have a way to disable the extendRefs warning #303

Closed
miikka opened this issue Sep 21, 2016 · 2 comments
Closed

Have a way to disable the extendRefs warning #303

miikka opened this issue Sep 21, 2016 · 2 comments

Comments

@miikka
Copy link

miikka commented Sep 21, 2016

What version of Ajv you are you using? 4.7.2
What problem do you want to solve? extendRefs warning about issue #260 is quite noisy.
What do you think is the correct solution to problem? Add a way to disable it.
Will you be able to implement it? Probably.

I'm working with an upstream schema that has $refs extended with additional keywords. I have extendRefs set to true and my log is now full of lines like this:

$ref: all keywords used in schema at path '.rule[' + i2 + ']' (it will change in the next major version, see issue #260)

Right now I'm working around it by setting console.log to a no-op while calling ajv.compile, but I'd prefer to have a configuration option to do it.

@epoberezkin
Copy link
Member

epoberezkin commented Sep 21, 2016

The purpose of the warning is to notify the users that the default behaviour will change in the next major version (in case the option is not specified). In your case, when the option extendRefs is explicitly set to true, the behaviour won't change so there is no need for the warning.

So we don't need an additional option, we can remove the warning in case the option is set to true (and update the message to suggest {extendRefs: true} to keep the current behaviour in case the option is undefined).

I also noticed that the message contains path expression rather than the actual path (i2 should be replaced with the actual number in the message) - it should be fixed as well.

@miikka PR is appreciated, thank you.

@epoberezkin
Copy link
Member

in 4.7.7

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