Skip to content

Giving an array argument to any.allow(...values) gives incorrect error #2187

@ChrisCrewdson

Description

@ChrisCrewdson

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: 10.16.3
  • module version with issue: 16.1.7
  • last module version without issue: 15.1.1
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): hapi
  • any other relevant information:

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

const joi = require('@hapi/joi')

const example = joi.string().allow(['', null]);
example.validate('bar');

// Error: Method no longer accepts array arguments: valid

What was the result you got?

An exception was thrown with the message "Method no longer accepts array arguments: valid"

What result did you expect?

An exception thrown with the message "Method no longer accepts array arguments: allow"

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