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 want to able to customize enum field validation message (for zod schema generation in my case) in a cleaner way. Currently the only workaround is converting the enum to a string value and using model level validation with the in operator as such
model User
{
...
role String
@@validate(role in ['ADMIN', 'USER'], 'you have to select a role')
}
I'm suggesting support for field level validation for enums just the same as for strings and numbers @Length(...), @min(...) etc, such as:
enum Role {
ADMIN
USER
}
model User
{
...
role Role @validate(message: "you have to select a role")
}
The text was updated successfully, but these errors were encountered:
I want to able to customize enum field validation message (for zod schema generation in my case) in a cleaner way. Currently the only workaround is converting the enum to a string value and using model level validation with the in operator as such
I'm suggesting support for field level validation for enums just the same as for strings and numbers @Length(...), @min(...) etc, such as:
The text was updated successfully, but these errors were encountered: