How do I validate that a field has the same value as another?
I am trying to implement a validation that checks if the email
field is the same value as the reemail
field. I previously used Yup and you could do this with the oneOf
method but I am not sure how one would do the same with Zod.
With Zod, how do I validate that a field has the same value as another?
I am trying to implement a validation that checks if the email field is the same value as the reemail field. I previously used Yup and you could do this with the oneOf method but I am not sure how one would do the same with Zod.
Can I Modify the value of property of z.object based selected language
I have simple input that is handled by react-hook-form
I have radio-buttons that I determin what is language that I make input’s value for and in the end I assume that I make just request to the server and send the content that I typed in the input in json form like
Validate implicit ‘undefined’ value in optional Zod field
This Zod validation fails when the provided value is a "undefined"
string.
Zod min length of string values in an array created using .transform
Is there a way to check the length of each string within an array after transform?
Zod schema to allow one of the properties in an object
I have an object which has a mandatory name
property, and contains nickname
or other
proprety. This is how my schema looks like,
Convert a zod object schema to a record type
const definition = z.object({ a: z.string(), b: z.number(), }) I want to have a type like this { a?: string, b?: number, } I don’t want to convert the object schema to make every key optional because it’s used as a definition map to match a sub schema to a key. So what I really […]