I am working with prisma and when I have to save an image, I save them as json value, like this: " model Tattoo { //... image Json //... } " then the image field is an object with fields like "publicUrl", "fileName", "fileSize"
The problem is that with this approach, prisma offers no validation or types for the image field: I can add images that do not fit in the expected shape.
What other approach could I use to make my image field more "type safe"?
Basically, while both keep doing their work, as zod-prisma-types is based on the prisma schema file, and there the json file is not type, the types and schemas generated by it are too wide (aka: not applying the types generated by json type generator)
Generates zod schemas from Prisma models with advanced validation. Latest version: 3.1.8, last published: 5 months ago. Start using zod-prisma-types in your project by running
npm i zod-prisma-types
npm i zod-prisma-types
. There are 6 other projects in the npm registry using zod-prisma-types.