Skip to content

Ref and Alternatives.when don't handle empty string keys #343

@jaswilli

Description

@jaswilli

Both of these schemas will throw assertion errors because ref is falsy:

Joi.object({
    a: Joi.alternatives().when('', { is: 5, then: Joi.valid('y') }),
    '': Joi.any()
});

and

Joi.object({
    a: Joi.ref(''),
    '': Joi.any()
});

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