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 without applying default values #682

Closed
ludoblues opened this issue Jul 10, 2015 · 6 comments
Closed

Validate without applying default values #682

ludoblues opened this issue Jul 10, 2015 · 6 comments
Assignees
Labels
feature New functionality or improvement
Milestone

Comments

@ludoblues
Copy link
Contributor

I need to be able to tune if a want the joi default values to be applied or not when validating my data.

I was thinking about an option "ignoreDefaults": joi.validate(data, schema, { ignoreDefaults: true }).
I would like to know what do you think about it before pushing a PR.

Thanks.

@Marsup
Copy link
Collaborator

Marsup commented Jul 10, 2015

What's the use case ?

@ludoblues
Copy link
Contributor Author

My default values varies between different contexts.
So when i am outside of this context, and i just want to validate my datas, there is no sense to apply default values.

@Marsup
Copy link
Collaborator

Marsup commented Jul 10, 2015

Do you still need coercion ?

@ludoblues
Copy link
Contributor Author

Yes, i would like to be able to use it with other options like stripUnknown.

@Marsup Marsup added the request label Jul 10, 2015
@Marsup Marsup self-assigned this Jul 10, 2015
@Marsup
Copy link
Collaborator

Marsup commented Jul 10, 2015

OK why not, let's go for a noDefaults.

@Marsup Marsup added this to the 6.6.0 milestone Jul 10, 2015
@Marsup Marsup closed this as completed Jul 13, 2015
@hueniverse hueniverse added feature New functionality or improvement and removed request labels Sep 19, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

3 participants