is this issue currently blocking your project? (yes/no): yes
is this issue affecting a production system? (yes/no): no
Context
node version: any
module version with issue: v17.9.1
last module version without issue:
environment (e.g. node, browser, native): browser
used with (e.g. hapi application, another framework, standalone, ...):
any other relevant information:
What are you trying to achieve or the steps to reproduce?
This is the schema I am working on. There are two fields: remarks and userList.
remarks can be optional(i.e. empty string or null) if userList is an empty array.
If userList contains some elements, then remarks turns into a required field.
I tried in my project as well as the sandbox in the document page(https://joi.dev/tester/), and both doesn't work as expected. It seems if matches with allow(), then the then part will never check.
What was the result you got?
Validation Passed
What result did you expect?
Validation Error: "remarks" is not allowed to be empty
Support plan
Context
What are you trying to achieve or the steps to reproduce?
This is the schema I am working on. There are two fields:
remarks
anduserList
.remarks
can be optional(i.e. empty string or null) ifuserList
is an empty array. IfuserList
contains some elements, thenremarks
turns into a required field.This is the data I am trying to validate:
I tried in my project as well as the sandbox in the document page(https://joi.dev/tester/), and both doesn't work as expected. It seems if matches with
allow()
, then thethen
part will never check.What was the result you got?
What result did you expect?