Accessing model relations with zod-prisma

I am using https://www.npmjs.com/package/zod-prisma which is a great package. For each of my prisma models, the package generates a file that exports two zod objects based on the model's fields. The first export is all of the "raw" (non-relational) data in the model. The second export extends the first export with all related models. I am wondering how exactly I use this second export. I don't see any examples in the docs.
The first image has the generated zod-prisma output for a "Post" model in my prisma schema. The second image is how I imagine the code would be used (but I am obviously misunderstanding something). Does this have something to do with the "z.lazy" portion of the code? Any help would be appreciated!
npm
zod-prisma
A Prisma generator that creates Zod schemas for all of your models. Latest version: 0.5.4, last published: a year 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.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server