Skip to content

Joi.reach() can no longer handles empty string path #1515

@jenchiunlin

Description

@jenchiunlin

Context

  • node version: 8.10.0
  • joi version: 13.3.0
  • environment (node, browser): node
  • used with (hapi, standalone, ...): standalone
  • any other relevant information:

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

Since Joi v13.1.3, Joi.reach() no longer handles empty string path as older versions.
It breaks our code (using Joi v13.1.0) after upgrading to v13.3.0.

const schema1 = Joi.object();

// prior to v13.1.3, schema2 will be schema1
const schema2 = Joi.reach(schema1, '');

// v13.1.3 or later, schema3 will be undefined
const schema3 = Joi.reach(schema1, '');

It seems to be a bug, and I'd like to submit a pull request to fix it.

Which result you had ?

What did you expect ?

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