Closed kroney closed 10 months ago
node.js
20
17.11.0
No response
Is there a way to use .allow() specifically to allow an array, e.g.:
.allow()
Joi.string().allow(['a']) // should allow any string and ['a'] // throws Uncaught Error: Method no longer accepts array arguments: allow
I can work around this by using alternatives or conditions, but I don't understand why allow does not accept arrays.
If you need to allow different schemas, you can use alternative(). Docs
alternative()
allow is there to compare pure values, the moment you need to compare complex objects, you probably need schemas.
allow
Runtime
node.js
Runtime version
20
Module version
17.11.0
Used with
No response
Any other relevant information
No response
How can we help?
Is there a way to use
.allow()
specifically to allow an array, e.g.:I can work around this by using alternatives or conditions, but I don't understand why allow does not accept arrays.