-
Notifications
You must be signed in to change notification settings - Fork 127
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
Consider replacing null values with the schema default during validation #124
Comments
Hum, I'm a bit torn on this. The value So if you want a default method for a field, and where |
Oh, and I forgot @marshall007 the most important -- Thanks for all the feedkback AND the PRs! |
@neumino my pleasure! I see what you mean, it might throw people off if they've been using On the other hand, setting a default value would seem to imply that the property is "non-nullable", at least to me. I'm having trouble imagining a scenario where you'd want both a default value and for |
Use |
@mstade |
Sure, but what I mean is why not just set your values to |
Sorry folks, this PR slipped through my mails. I don't really want to change the default because that could break people code (to some extend, I try not to break anything). Part of the refactoring of the schema was to also split options. I was thinking about adding methods like The reason why it would nice to replace |
Agreed, it shouldn't be the default, but I think it makes complete sense under |
I think it would make sense for
.validate()
to populate defaults fornull
values.Works as expected when
doc.price
isundefined
:Doesn't work when
doc.price
isnull
:The text was updated successfully, but these errors were encountered: