Closed zomars closed 1 year ago
@zomars I didn't use zod-prisma
since it was abandoned when I started using zod. But from what I can see there are a few differences:
zod-prisma
allowed to define a suffix that would then be added to the generated model. That is not possible in zod-prisma-types
. Here the suffix is always Schema
There is no option to switch between pascal and camelcase since model or field names where uppercase and lowercase words are mixed could not be represented in camelcase. see #38
When using custom validators an additional key needs to be used to specify on which type the validator is used.
model MyModel {
myField String /// @zod.string.min(3, { message: "min error" })
myField Int /// @zod.number.lt(10, { message: "lt error" })
}
Please refer to the docs for now for a detailed explanation on the @zod
validators.
I'll dig through the zod-prisma
docs and check for more differences when I have a bit of free time the next days. When I have a comprehensive list I'll add a migration guide to the docs.
Seconded, I'm actually looking to migrate to this library as well. Who knows, if my schedule frees up I might even be up for contributing.
But before I can move over, I would prefer to have some more functionality which was supported by zod-prisma
included in this library such as the nested models referenced in #54.
I would therefore like to suggest maintaining some sort of overview of the features previously supported by zod-prisma
and the corresponding/alternative features in zod-prisma-types
, is that something you would be open to doing?
It might encourage people (such as myself) to contribute by creating PRs they are excited to see.
@zomars, @Katli95 I just released version 2.0.0-beta.0
that supports generation of multiple files, generation of relation fields on model types and some other requested features. Please give it a try. The beta docs can be found here. The docs now also have a short info section about all the differences to be aware of when migrating from zod-prisma
npm:
npm install zod-prisma-types@2.0.0-beta.0
yarn:
yarn add zod-prisma-types@2.0.0-beta.0
pnpm:
pnpm add zod-prisma-types@2.0.0-beta.0
closing since version 2.0.1
is now released and a short migration guide is included in the docs. Since I'm not versed with what zod-prisma
was capable of please open a new issue or submit a PR with direct changes to the docs if you feel something is missing in the migration reference.
We're looking into adopting this library since
zod-prisma
seems to be abandoned. Would you recommend a migration path forzod-prisma
users? I think this would help a lot to increase adoption.