✨ This is edited nestjs-zod-prisma with new features ✨
npm i better-nestjs-zod-prisma
you still have to specify
provider = "nestjs-zod-prisma"
In prisma schema file And Not
provider = "better-nestjs-zod-prisma"
- It's part of the upcoming PR.
It now supports Swagger out of the box, you can just have your schema defined and it will be swaggered using the @anatine/zod-openapi
and also you can customize that using .openapi()
nullable
instead of nullish
when it comes to the optional fields which make sense more.
When it comes to Enums this package had a big issues, one of them is duplicated imports that is resolved in this enhanced package
another issue was TypeError between Enums that defined in Prisma and the generated zod schema that has enum so we fixed that to use the prisma enums to match the prisma type
and a lot more..
Only one missing feature which is z.from(schema)
because we switched from using nestjs-zod
to @anatine/zod-openapi
but we can achieve same goal by using this way @z.custom().and(schema)
And I am open and happy to improve that.
This package needs editing the tests to match the changes and also needs better Readme file So I would be happy if someone helped me in that
Zod Prisma doesn't work well with nestjs-zod-prisma
and its author has been inactive for a long time - so I created this fork to fix the problems that I suffered from.
To work better with nestjs-zod
, this library provides a little different API for Prisma rich comments directives.
You can use @z.custom().and(imports.schema)
for using your own schemas.
Also, this library generates DTOs for better NestJS integration. It's done using createZodDto
from @anatine/zod-nestjs
.
And we still support the JSDoc comments.
Mohammad Abdalrazzak - [email protected] Discord - username: saybers, id: 304257501980000277
Project Link: https://github.com/mohrazzak/better-nestjs-zod-prisma
Project Link: https://github.com/risen228/nestjs-zod-prisma