-
Notifications
You must be signed in to change notification settings - Fork 55
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
Comments
This looks useful: https://github.com/ruby-json-schema/json-schema |
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. |
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.
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.
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. |
That sounds about right
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? |
Woah, 43 times faster is a compelling argument. Good suggestion. I will give it a go! |
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).
The text was updated successfully, but these errors were encountered: