drizzle-zod is not sending custom message upon validation
I have created the following loginValidationSchema which I call in a validateData middleware inside my routes. I was expecting the custom error message to be sent to user whenever the user does not provide a value but it is not working
\ zod-schema
//Routes
//Middleware
When a user forgets to send email when using the login route, I was expecting the error message to be 'email: Email is required' but I am receiving 'email: Required' instead. Why is this happening?
1 Reply
I believe 'email: Email is required' happens only if the string doesn't have a minimum length of 1, not when the email is missing as a key. Basically, the difference between email: "" and email being undefined