-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codebugBug or defectBug or defect
Milestone
Description
Context
- node version: 8.6.0
- joi version: 13.2.0
- environment (node, browser): Chrome
- used with (hapi, standalone, ...): Standalone
What are you trying to achieve or the steps to reproduce ?
I'm trying to validate a possitive integer which length is between 10 and 15 characters
This is the code I am using
function validateNumber (value) {
return _.isNull(joi.validate(value, joi.string().required().min(10).max(15)).error) &&
_.isNull(joi.validate(value, joi.number().integer().min(0).required()).error);
}
Which result you had ?
I used as a value 999999999. (9 integers and a decimal point) and joi validates it as a 10 digit integer
What did you expect ?
I expected it to throw an error as it is not a digit. Given 999999999.9 as value throws an error correctly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codebugBug or defectBug or defect