Skip to content

Giving an array argument to any.valid returns incorrect error #2254

@nclsndr

Description

@nclsndr

Support plan

  • which support plan is this issue covered by?: Community
  • is this issue currently blocking your project?: No
  • is this issue affecting a production system?: No

Context

  • node version: 12.14.0
  • module version with issue: 16.1.8
  • last module version without issue: 14.3.1 (the one I use but not last)
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

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

const someStringSchema = Joi.string().valid(['someValue'])

What was the result you got?

An error message as expected because of moving from array args to list of args BUT
The error message is wrong: Method no longer accepts array arguments: allow

What result did you expect?

I imagine we want Joi to warn us about the valid method not allow (that had the same issue earlier)
Method no longer accepts array arguments: valid

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