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

Feature Request: add drizzle-zod for mutation input validation #66

Open
tconroy opened this issue May 28, 2024 · 1 comment
Open

Feature Request: add drizzle-zod for mutation input validation #66

tconroy opened this issue May 28, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@tconroy
Copy link

tconroy commented May 28, 2024

Is your feature request related to a problem? Please describe.
trpc allows you to provide a Zod schema to the input() argument for mutations:

export const exampleRouter = createRouter({
                           // Here: v
  create: protectedProcedure.input(...).mutation(({ ctx }) => {
    const { user, db } = ctx;
  }),
});

It would be great if we could use the schema types we define in the DB package for inferring the necessary input.

Describe the solution you'd like
drizzle-zod exists to solve this problem, as it's a plugin for Drizzle ORM that allows you to generate Zod schemas from Drizzle ORM schemas.

Describe alternatives you've considered
N/A

Additional context
Should these be defined in the API package? Or the DB package? (if DB: we'd need to make all the schema types publicly accessible / external to the package.)

@ixahmedxi
Copy link
Owner

Oh yes that should be easy to do.

@ixahmedxi ixahmedxi added the enhancement New feature or request label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants