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
Improved joiOptions object handling #6
Comments
Thanks for posting. I'm not sure what I thought about what you pointed out about the There is also now the issue of this being breaking change. |
@eddyystop I agree with you, but once we decide to work with Joi, we make this decision being aware of what Joi provide us out of the box. I think it's more reliable to anyone who wants to validate with Joi, to keep its default options. |
The repo has to remain backward compatible where possible. If you can do that, please submit a PR. |
Closing this now that #9 has been merged. |
Two suggestions:
When a null or undefined value is passed as joiObject, just default it to empty object. That's what joi does. Currently the code throws exception if an object type is not passed.
Invert the check for convert option.
According to joi API docs, convert option defaults to true:
The exception would be that passing an empty object as joiOptions means that convert is enabled by default, thus the hook should replace the data with the converted value by default.
The text was updated successfully, but these errors were encountered: