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

Validate configuration #176

Closed
lencioni opened this issue Jan 31, 2016 · 5 comments · Fixed by #612
Closed

Validate configuration #176

lencioni opened this issue Jan 31, 2016 · 5 comments · Fixed by #612

Comments

@lencioni
Copy link
Collaborator

It would be nice if I saw a warning if my configuration file contained a key that Import-JS doesn't know about. Even better if it would validate some or all of the values.

I think that this would help people who have misconfigured something, but also would help people who have too new of configuration or too new of a plugin for the configuration (a possible solution to some issues we discussed in #153).

@lencioni lencioni added this to the 1.0.0 milestone Jan 31, 2016
@lencioni lencioni changed the title Warn when encountering unexpected configuration Validate configuration Jan 31, 2016
@lencioni
Copy link
Collaborator Author

@trotzig
Copy link
Collaborator

trotzig commented Jan 31, 2016

I've thought about this too. It's important that we find a way that is helpful without being too strict. Validation is likely to tie the configuration file to a certain version of the plugin, which might not always be a good thing. That being said, if we implement it the right way it should help out in the situations you listed above.

@lencioni lencioni removed this from the 1.0.0 milestone Apr 28, 2016
lencioni added a commit that referenced this issue May 2, 2016
This adds a message for each configuration key that we encounter that is
not recognized. This will help prevent people from having bad
configuration which could arise from typos or old keys sitting around.

Partly addresses #176.
lencioni added a commit that referenced this issue May 2, 2016
This adds a message for each configuration key that we encounter that is
not recognized. This will help prevent people from having bad
configuration which could arise from typos or old keys sitting around.

Partly addresses #176.
@mikabytes
Copy link
Collaborator

Do I understand it correctly that what remains on this issue is to validate the values of correct fields?

I've used Yup (joi) for schema validation for APIs in the past. I could give this a go if needed.

@lencioni
Copy link
Collaborator Author

Do I understand it correctly that what remains on this issue is to validate the values of correct fields?

That sounds about right

I've used Yup (joi) for schema validation for APIs in the past. I could give this a go if needed.

I'm not familiar with yup or joi, but have used json schema with ajv in the past and that has worked well for me. Also, I found this benchmark that makes it seem that yup and joi are quite slow in comparison, FWIW: https://github.com/icebob/validator-benchmark

What do you think about ajv and a json schema?

@mikabytes
Copy link
Collaborator

Woah, 43 times faster is a compelling argument. Good suggestion. I will give it a go!

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

Successfully merging a pull request may close this issue.

3 participants