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

truthy() / falsy() values apply when convert is false #1736

Closed
kanongil opened this issue Feb 27, 2019 · 0 comments
Closed

truthy() / falsy() values apply when convert is false #1736

kanongil opened this issue Feb 27, 2019 · 0 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@kanongil
Copy link
Contributor

Context

  • node version: n/a
  • joi version: current
  • environment (node, browser): n/a
  • used with (hapi, standalone, ...): standalone
  • any other relevant information:

There is an internal inconsistency, where the convert options does not apply to truthy() / falsy() values, but does apply to the built-in "true" / "false".

What are you trying to achieve or the steps to reproduce ?

const schema = Joi.boolean().truthy('y');

Joi.validate('true', schema, { convert: false }); // returns ValidationError

Joi.validate('y', schema, { convert: false }); // => returns `value: true`
@WesTyler WesTyler added the bug Bug or defect label Mar 1, 2019
@WesTyler WesTyler assigned kanongil and unassigned kanongil Mar 1, 2019
@hueniverse hueniverse self-assigned this May 30, 2019
@hueniverse hueniverse added this to the 16.0.0 milestone May 30, 2019
@Marsup Marsup mentioned this issue Jun 9, 2019
@hueniverse hueniverse added the v16 label Aug 10, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

3 participants