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
I'm using zod in conjunction with react-hook-form. (I don't think the use of react-hook-form is relevant, but I'm mentioning it just in case.) I have a simple schema defined as follows:
constschema=z.object({email: z.boolean(),slack: z.boolean(),}).refine((input)=>input.email||input.slack,{message: "At least one target is required"},);
When validation runs, the refinement error "At least one target is required" gets added to a key of "" instead of "root". If I log my errors object to the console, I see:
{
"": {
"message": "At least one integration target is required",
"type": "custom"
}
}
I'm expecting to see:
{
"root": {
"message": "At least one integration target is required",
"type": "custom"
}
}
I've tried specifying options for path: [] and path: ["root"] to refine, but neither seems to help. (The former results in the same thing, the latter results in an empty errors object.)
The text was updated successfully, but these errors were encountered:
I'm using zod in conjunction with react-hook-form. (I don't think the use of react-hook-form is relevant, but I'm mentioning it just in case.) I have a simple schema defined as follows:
When validation runs, the refinement error "At least one target is required" gets added to a key of
""
instead of"root"
. If I log myerrors
object to the console, I see:I'm expecting to see:
I've tried specifying options for
path: []
andpath: ["root"]
torefine
, but neither seems to help. (The former results in the same thing, the latter results in an empty errors object.)The text was updated successfully, but these errors were encountered: