You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above example, the refine function should validate that the sum of val1 and val2 is less than or equal to 10. However, if val3 is missing from the input object, the refine function doesn't get executed at all, even though val3 is not involved in the validation process.
is it possible, that the refine function gets executed as soon as the values specified in the path array are set and validated, regardless of the presence of other fields in the input object.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
let's assume i got the following code:
In the above example, the refine function should validate that the sum of val1 and val2 is less than or equal to 10. However, if val3 is missing from the input object, the refine function doesn't get executed at all, even though val3 is not involved in the validation process.
result1
{"success":false,"error":{"issues":[{"code":"invalid_type","expected":"number","received":"undefined","path":["val3"],"message":"Required"}],"name":"ZodError"}}
result2
{"success":false,"error":{"issues":[{"code":"custom","path":["val1","val2"],"message":"Invalid input"}],"name":"ZodError"}}
is it possible, that the refine function gets executed as soon as the values specified in the path array are set and validated, regardless of the presence of other fields in the input object.
Beta Was this translation helpful? Give feedback.
All reactions