-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add an separator parameter to Joi.reach #1383
Comments
@pierreis We're always glad to take a look at PRs and do our best to get them merged, if this is something you'd like to see I'd suggesting giving it a stab in a PR. I would suggest utilizing an As an example, Hoek.reach() supports a number of parameters and you can see the relevant code here. |
I'd rather take an array directly instead of adding new options. |
That would solve the issue, indeed. |
Makes sense to me. |
@Marsup, I am ready to solve this issue by adding separator parameter to reach function |
I wrote a few posts above that I don't want this parameter, but you're free to do a PR following those instructions. Please ask if it's not clear. |
Hi @Marsup, just to make sure that I am understanding the issue. |
Correct, a pre-split array instead of the current path. |
Currently, the separator of
Joi.reach
is fixed as a dot. This might not be a good choices for for use cases where object keys are e-mails or URLs, causing the method not to behave as expected.I would suggest adding a third parameter
separator
to that method, allowing to be user-configured. For example, slashes can make sense for compatibility with JSON patch. The default would remain a dot for compatibility.The text was updated successfully, but these errors were encountered: