tRPC Input from a Prisma Schema
Is there any way to tell tRPC (zod technically i guess) to expect a tRPC schema as a type? like
procedure.input({myType: z.tRPC(myType)}).query()
or something6 Replies
why would you need that?
Then he doesn't need to rewrite the type definition? I don't know the answer to this Op
i can list some reasons that you dont want to 1:1 input and schemas
but if you really want to
npm
zod-prisma
A Prisma generator that creates Zod schemas for all of your models. Latest version: 0.5.4, last published: 10 months ago. Start using zod-prisma in your project by running
npm i zod-prisma
. There are 2 other projects in the npm registry using zod-prisma.That's a whole different discussion, but you asked why hahahahaha
Mainly due to null/undefined bs
I just do my own validation
no yeah agreed, its definitely not the ideal in a lot of situations
great thakn you