joi icon indicating copy to clipboard operation
joi copied to clipboard

Allow in newer versions doesn't seem to be backwards compatible?

Open williamblevins opened this issue 4 years ago • 1 comments
trafficstars

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: v14.17.5
  • module version: 17.4.2 (tried other versions also)
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): N/A
  • any other relevant information: N/A

How can we help?

joi.string().allow('HEAD').hex().min(6).max(40).lowercase().required() does not allow for the string HEAD, which is explicitly allowed. Can someone explain what I am doing wrong?

williamblevins avatar Aug 13 '21 00:08 williamblevins

Looks like I can work around this with this joi.alternatives(joi.string().valid('HEAD'), joi.string().hex().min(6).max(40).lowercase()).required().

williamblevins avatar Aug 13 '21 14:08 williamblevins