-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Context
- node version: 6.5.0
- joi version: 10.2.0
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information: -
What are you trying to achieve or the steps to reproduce ?
const schema = Joi.number().empty(5).default(5);
const res1 = Joi.validate({ Test: 5 }, { Test: schema }, { noDefaults: false });
const res2 = Joi.validate({ Test: 5 }, { Test: schema }, { noDefaults: true });Which result you had ?
res1.Test === 5
res2.Test === 5
What did you expect ?
res1.Test === 5
res2.Test === undefined
Hello ! i'm able to it work by changing L450 of lib/any.js from :
else if (options.noDefaults) {
finalValue = originalValue;
}to:
else if (options.noDefaults) {
finalValue = value;
}not sure it didn't break something else in the process tho... ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect