Skip to content

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

@kanongil

Description

@kanongil

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`

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions