chrishoermann / zod-prisma-types

Generator creates zod types for your prisma models with advanced validation
Other
579 stars 43 forks source link

All 'XXXIncludeSchema' Are Generated as 'z.object({ }).strict()' in MongoDB Environments #189

Open ksdaylight opened 9 months ago

ksdaylight commented 9 months ago

Great job on the library; it's made my dev life easier. Thanks

However, I have come across an issue that only appears when I am using MongoDB. The issue does not manifest when I switch to traditional relational databases like MySQL.

Specifically, all generated 'XXXIncludeSchema' objects appear as: image Even when the corresponding Prisma.XXXInclude has actual content. image

On the other hand, everything works as expected when I am using a traditional relational database like MySQL. image This issue is causing some inconsistencies in my application and I was wondering if this is a known issue or if there's a workaround for it.

Looking forward to your response, and thank you once again for this fantastic library!

My environment versions are:

prisma: 5.1.1 zod: 3.21.1 zod-prisma-types: ^2.7.9

chrishoermann commented 8 months ago

@ksdaylight Thanks for reaching out. Since I do not use MongoDB in any of my projects I don't have real usecases. It would be nice if you can provide a schema I can work with.

This could also be something prisma changed in the 5.x.x release since the include schemas were generally empty in my tests I did some month back.