Error not throwing #700
Replies: 1 comment
-
export const customerCreateBody = z
.object({
"customerId": z.number(),
"fullname": z.string(),
"username": z.string().min(customerCreateBodyUsernameMin).regex(customerCreateBodyUsernameRegExp),
"gender": z.string(),
"speaks": z.array(z.string()).min(1)
})
.refine(data => data.fullname !== '' || data.username !== '', {
message: 'Customer must have the fullname or username defined',
// Optional. Zod will default it based on the position of the schema you are refining.
// In this example, it would be `[]`, which indicate root
path: [],
})
Conform is always comparing your default value with the actual form value presented in the form. If it is considered dirty, then it's likely you have some fields forgot to rendered, or initialized with a different value for some reason. You can check the current form value by inspecting |
Beta Was this translation helpful? Give feedback.
-
Hi,
Then
Beta Was this translation helpful? Give feedback.
All reactions