[v5] How do I skip rule validation when value is optional? #2234
Replies: 5 comments 5 replies
-
@dessonchan why don't you create a second schema with that particular validation, remove it from the first one, and run the validator on that second schema ONLY if the web field is present on the request? Or conditionally set the object going into |
Beta Was this translation helpful? Give feedback.
-
I just gave this code a try and it seems to be working fine for me even if I send |
Beta Was this translation helpful? Give feedback.
-
I had a similar problem and I solved it this way:
|
Beta Was this translation helpful? Give feedback.
-
Encountering this as well even tried to use |
Beta Was this translation helpful? Give feedback.
-
I'm using schema.enum.optional(...) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have some code like this, when the website is null validator is giving a result of url validation filed. How can I skip the rule checking if the input value is null?
Beta Was this translation helpful? Give feedback.
All reactions