-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugBug or defectBug or defect
Description
Runtime
node.js
Runtime version
22.15.1
Module version
17.13.3
Last module version without issue
No response
Used with
No response
Any other relevant information
No response
What are you trying to achieve or the steps to reproduce?
When validating a String as a boolean, I would expect "true " (with a trailing space) to be validated to be true.
This fails, but I would expect it to succeed:
Joi.boolean().validate('true ')
The handling seems inconsistent with numbers for example, which work as I expect.
Joi.number().validate('123 ')
// gives { value: 123 }
What was the result you got?
{
value: 'true ',
error: [Error [ValidationError]: "value" must be a boolean] {
_original: 'true ',
details: [ [Object] ]
}
}
What result did you expect?
{ value: true }
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect