Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for model level definition #133

Open
michiim opened this issue Jun 22, 2022 · 0 comments
Open

Add support for model level definition #133

michiim opened this issue Jun 22, 2022 · 0 comments

Comments

@michiim
Copy link

michiim commented Jun 22, 2022

Would be great to have support for zod-definitions on model level.

example:

/// @zod.refine((val) => val.type === 'PRIVATE' || val.company !== null, { path: 'company', message: 'Required if type is company' })
model Address {
  id                         String      @id @unique @default(uuid())
  type                       AddressType
  company                    String? /// @zod.min(1).max(50)
  address                    String /// @zod.min(1).max(50)
  zipCode                    String /// @zod.min(1).max(10)
  city                       String /// @zod.min(1).max(50)
}

enum AddressType {
  PRIVATE
  COMPANY
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant