Prisma 2+ generator to emit Zod schemas from your Prisma schema

Overview

Prisma Zod Generator

npm version npm HitCount npm

Automatically generate Zod schemas from your Prisma Schema, and use them to validate your API endpoints or any other use you have. Updates every time npx prisma generate runs.

Buy Me A Coffee

Table of Contents

Installation

Using npm:

 npm install prisma-zod-generator

Using yarn:

 yarn add prisma-zod-generator

Usage

1- Star this repo 😉

2- Add the generator to your Prisma schema

generator zod {
  provider = "prisma-zod-generator"
}

3- Enable strict mode in tsconfig as it is required by Zod, and considered a Typescript best practice

{
  "compilerOptions": {
    "strict": true
  }
}

4- Running npx prisma generate for the following schema.prisma

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}

model Post {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String
  content   String?
  published Boolean  @default(false)
  viewCount Int      @default(0)
  author    User?    @relation(fields: [authorId], references: [id])
  authorId  Int?
}

will generate the following files

Zod Schemas

5- Use generated schemas somewhere in your API logic, like middleware or decorator

import { PostCreateOneSchema } from './prisma/generated/schemas/createOnePost.schema';

app.post('/blog', async (req, res, next) => {
  const { body } = req;
  await PostCreateOneSchema.parse(body);
});

Additional Options

Option  Description Type  Default
output Output directory for the generated zod schemas string ./generated

Use additional options in the schema.prisma

generator zod {
  provider   = "prisma-zod-generator"
  output     = "./generated-zod-schemas"
}
Comments
  • Refactor + select support

    Refactor + select support

    Hi Omar I'm BitPhoenix, it's a pleasure to meet you. I wanted to start off by thanking you for creating such an awesome package! It's very useful and has helped me a lot. I really appreciate the hard work you continue to put into it.

    My apologies that the refactor and fix are in one pull review, and that the commits are larger than normal. I'll make sure to separate them in the future.

    Since this is quite a big pull request, please let me know if you'd like to hop on a voice chat to go through the changes together, in case that would help make things easier.

    References

    Description

    I started out by trying to fix the missing select issue referenced here: https://github.com/omar-dulaimi/prisma-trpc-generator/issues/13

    To help me better understand the codebase, I started refactoring the prisma-generator.ts and transformer.ts files as I read through the code to get hands on and aid in understanding. Pretty small things like:

    • Extracting grouped logic into functions in prisma-generator.ts
    • Updating some variable / function names for clarity / consistency
    • Reorganizing function order in transformer.ts to decrease vertical distance
    • Extracting missing mongo type generation into a separate file + functions

    After I finished performing the above changes and understood the codebase, I added functions to src/helpers/helpers.ts responsible for generating the types needed to support select. I plan on working on include next and will likely update the file / folder structure in a future pull request to represent that this group of functions is for adding the select related types (similar to how we now have a file dedicated to mongo missing type generation logic).

    The screenshots below show the generated zod schema which will help a lot to explain what the end goal was of the code that was added to src/helpers/helpers.ts. The short version is:

    Appropriate queries have a select property (Unique example is pictured) Screen Shot 2022-10-28 at 3 32 10 PM

    ModelSelect schema is generated. If the model has a many relation with another model, we include a union with the find many schema for that model. We also include the _count property image

    If the model has a single relation with another model, we union with args object schema for that model. If the model does not have a many relation with another model, _count will not be present. Screen Shot 2022-10-28 at 3 37 48 PM

    opened by BitPhoenix 14
  • Support extendedWhereUnique preview feature

    Support extendedWhereUnique preview feature

    Bug description

    Generated schema for ModelVacancyWhereUniqueInputObjectSchema is invalid.

    How to reproduce

    1. Add latest prisma and generator version
    2. run prisma generate
    3. Inspect ModelVacancyWhereUniqueInputObjectSchema file for any model
    4. See error

    Screenshot_20221204_221504

    Expected behavior

    Generated schema should not contain any errors.

    Prisma information

    generator zod {
      provider          = "prisma-zod-generator"
      output            = "./generated/zod"
      isGenerateSelect  = true
      isGenerateInclude = true
    }
    

    Environment & setup

    • OS: Linux ()
    • Database: PostgreSQL
    • Node.js version: v18.4.0

    Prisma Version

    prisma                  : 4.7.1
    @prisma/client          : 4.7.1
    Current platform        : debian-openssl-3.0.x
    Query Engine (Node-API) : libquery-engine 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
    Migration Engine        : migration-engine-cli 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
    Introspection Engine    : introspection-core 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/introspection-engine-debian-openssl-3.0.x)
    Format Binary           : prisma-fmt 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/prisma-fmt-debian-openssl-3.0.x)
    Format Wasm             : @prisma/prisma-fmt-wasm 4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c
    Default Engines Hash    : 272861e07ab64f234d3ffc4094e32bd61775599c
    Studio                  : 0.477.0
    
    enhancement 
    opened by mubaidr 12
  • transformer update

    transformer update

    Hello sir, thank you for creating this library as it helped me with my work (linking existing db and tables in client), however i want to help you with handling recursive types.

    Description

    1. As mentioned in zod description, best way to handle recusive types is to privide implicit typing. And output of prisma generator is exactly what is needed, so i suggest to import them and type zod-validators with it as shown below
    import { z } from 'zod';
    import { NestedBoolFilterObjectSchema } from './NestedBoolFilter.schema';
    
    import type { Prisma } from '@prisma/client';
    
    const Schema: z.ZodType<Prisma.BoolFilter> = z
      .object({
        equals: z.boolean().optional(),
        not: z
          .union([z.boolean(), z.lazy(() => NestedBoolFilterObjectSchema)])
          .optional(),
      })
      .strict();
    
    export const BoolFilterObjectSchema = Schema;
    
    1. To fix any recursive imports problem wrap every ObjectSchema with z.lazy

    Also there were some things i suggest to change:

    1. Use strict on every ObjectSchema, because without it unions with objects, where all fields are optional, work incorrectly
    const union = z.union([
        z.object({ foo: z.string().optional() }),
        z.object({ bar: z.string().optional() })
    ])
    
    const res = union.parse({ bar: "" }) // {}, 
    

    bar is stripped because it passes in first union member and default zod behaviour is to strip unknown fields so with .strict() it will force zod to validate inputs until correct union member is found

    1. Small refactoring in Transformer class - default properties values in constructor and types fixes overall

    I used generator with my improvements on db with 17 tables and haven't yet found any problems (tho i am not sure how lines like field.includes('Filter') we working before)

    P.S.: maybe in README should be suggested to git-ignore all generated schemas, because in my case i got 1k+ files...

    enhancement 
    opened by StireArLankar 11
  • Optional typing in unions strips all properties

    Optional typing in unions strips all properties

    Bug description

    Generated types for relationships leverage zod union types, but when all the constituent components are optional the parsed output forcefully becomes an empty object {}.

    For the prisma schema provided further below, the generated WidgetCreateInputObjectSchema looks like this:

    const Schema: z.ZodType<Prisma.WidgetCreateInput> = z
      .object({
        version: z.lazy(() => FormVersionCreateNestedOneWithoutWidgetsInputObjectSchema),
        step: z.lazy(() => StepCreateNestedOneWithoutWidgetsInputObjectSchema),
      })
      .strict();
    

    And the nested version schema is a zod union like this:

    const Schema: z.ZodType<Prisma.FormVersionCreateNestedOneWithoutWidgetsInput> = z.union([
      z.object({
        create: z
          .union([
            z.lazy(() => FormVersionCreateWithoutWidgetsInputObjectSchema),
            z.lazy(() => FormVersionUncheckedCreateWithoutWidgetsInputObjectSchema),
          ])
          .optional(),
      }),
      z.object({
        connectOrCreate: z.lazy(() => FormVersionCreateOrConnectWithoutWidgetsInputObjectSchema).optional(),
      }),
      z.object({
        connect: z.lazy(() => FormVersionWhereUniqueInputObjectSchema).optional(),
      }),
    ]);
    

    This looks fine at first glance, but making all of create, connectOrCreate, and connect optional makes parse return an empty object {}.

    console.log(
        WidgetCreateInputObjectSchema.parse({
          step: { connect: { id: 1 } },
          version: { connect: { id: 2 } },
        }),
      );
    // { "version": {}, "step": {} }
    

    However if you drop the .optional off any (or all, realistically) of the union types:

    const schema = z
        .object({
          version: z.lazy(() =>
            z.union([
              z.object({
                create: z.union([
                  z.lazy(() => FormVersionCreateWithoutWidgetsInputObjectSchema),
                  z.lazy(() => FormVersionUncheckedCreateWithoutWidgetsInputObjectSchema),
                ]),
              }),
              z.object({
                connectOrCreate: z.lazy(() => FormVersionCreateOrConnectWithoutWidgetsInputObjectSchema),
              }),
              z.object({
                connect: z.lazy(() =>
                  z
                    .object({
                      id: z.number(),
                    })
                    .strict(),
                ),
              }),
            ]),
          ),
          step: z.lazy(() => StepCreateNestedOneWithoutWidgetsInputObjectSchema),
        })
        .strict();
    

    then the output works as expected:

    console.log(
        schema.parse({
          step: { connect: { id: 1 } },
          version: { connect: { id: 2 } },
        }),
      );
    // { "version": { "connect": { "id": 2 } }, "step": {} }
    

    How to reproduce

    See above.

    Expected behavior

    Parsing correctly structured input should not return an empty object.

    Prisma information

    model Form {
      id    Int @id @default(autoincrement())
    }
    
    model Step {
      // Identifier Fields
      id      Int @id @default(autoincrement())
      formid  Int
    
      // 1:N Relationships
      form    Form        @relation(fields: [formId], references: [id], onDelete: Cascade)
      widgets Widget[]
    }
    
    model Widget {
      // Identifier Fields
      id        Int @id @default(autoincrement())
      versionId Int
      stepId    Int
    
      // 1:N Relationships
      form   Form @relation(fields: [formid], references: [id], onDelete: Cascade)
      step   Step  @relation(fields: [stepId], references: [id], onDelete: Cascade)
    }
    

    Environment & setup

    • OS: MacOS
    • Database: PostgreSQL
    • Node.js version: 16.13.2

    Prisma Version

    4.2.1

    opened by SamuelMS 10
  • Fixed bug: include no longer generated for models that do not have relations with other models

    Fixed bug: include no longer generated for models that do not have relations with other models

    Description

    Original bug: Include was being generated for models that do not have relations with other models. A prisma client type that does not exist was being referenced in the generated zod schema.

    Fix: Include is only generated for models that have a relation with another model. The referenced prisma client type in the generated zod schema exists for these models.

    I added a model to our schema.prisma that does not have a relation to any other models (Book). This will help us catch issues like this more easily in the future, as we do not currently have a model like this in the schema.prisma file.

    References

    Fixes issue: https://github.com/omar-dulaimi/prisma-zod-generator/issues/36

    opened by BitPhoenix 8
  • Fix schema generation for prisma preview feature - fullTextSearch

    Fix schema generation for prisma preview feature - fullTextSearch

    Hi @omar-dulaimi, thanks for creating this awesome project. I would like to integrate a fix that is related to prisma preview feature.

    References

    https://www.prisma.io/docs/concepts/components/prisma-client/full-text-search

    Description

    If we use fullTextSearch (one of the preview features prisma offers) with MySQL or PostgreSQL, then prisma exports UserOrderByWithRelationAndSearchRelevanceInputObjectSchema instead of UserOrderByWithRelationInputObjectSchema. Screenshot from 2022-12-08 20-01-02 Screenshot from 2022-12-08 20-02-00

    But in the transformer class while generating model schemas, currently we statically import the UserOrderByWithRelationInputObjectSchema. So I have added a resolve function that will return an import and zod-schema-line(like we do for include and select field) for orderBy field.

    opened by Shahidul1004 5
  • [prisma v2.x] Types for createOne / updateOne may be incomplete

    [prisma v2.x] Types for createOne / updateOne may be incomplete

    Bug description

    Disclaimer: Not yet sure if this is a capital-b BUG as I'm new to the prisma ecosystem, but figure this is a decent place to put this discussion as Discussions is pretty empty here. Please push back if there's a better place to put this.

    TLDR - It's possible that the schemas generated for createOneFoo and updateOneFoo are intended to be a union between FooUpdateInput and FooUncheckedUpdateInput, whereas right now they are simply FooUpdateInput.

    Notable that I'm using [email protected] so this may be specific to that older version. Uncertain, but figured I'd share in case it's helpful.

    How to reproduce

    I'm using [email protected] and the prisma-client generator generates the following types for a User update-client:

    // node_modules/.prisma/client/index.d.ts
      /**
       * User update
       */
      export type UserUpdateArgs = {
        /**
         * Select specific fields to fetch from the User
         * 
        **/
        select?: UserSelect | null
        /**
         * Choose, which related nodes to fetch as well.
         * 
        **/
        include?: UserInclude | null
        /**
         * The data needed to update a User.
         * 
        **/
        data: XOR<UserUpdateInput, UserUncheckedUpdateInput>
        /**
         * Choose, which User to update.
         * 
        **/
        where: UserWhereUniqueInput
      }
    

    We're then using prisma-trpc-generator, and the zod-schema that gets generated under the hood looks like this:

    // generated/schemas/updateOneUser.schema.ts
    import { z } from "zod";
    import { UserUpdateInputObjectSchema } from "./objects/UserUpdateInput.schema";
    import { UserWhereUniqueInputObjectSchema } from "./objects/UserWhereUniqueInput.schema";
    
    export const UserUpdateOneSchema = z.object({
      data: UserUpdateInputObjectSchema,
      where: UserWhereUniqueInputObjectSchema,
    });
    

    I'm fairly certain there's a mismatch here? If I use the client where data is of the shape UserUncheckedUpdateInput, prisma accepts the input and updates the entity as desired, but the zod validator gets in the way and tells me that it's looking for UserUpdateInputObjectSchema.

    Expected behavior

    I'd expect for the schema to look like this.

    // generated/schemas/updateOneUser.schema.ts
    import { z } from "zod";
    import { UserUpdateInputObjectSchema } from "./objects/UserUpdateInput.schema";
    import { UserUncheckedUpdateInputObjectSchema } from "./objects/UserUncheckedUpdateInput.schema";
    import { UserWhereUniqueInputObjectSchema } from "./objects/UserWhereUniqueInput.schema";
    
    export const UserUpdateOneSchema = z.object({
      data: z.union([UserUpdateInputObjectSchema, UserUncheckedUpdateInputObjectSchema]),
      where: UserWhereUniqueInputObjectSchema,
    });
    

    I'm currently using a fork of prisma-zod-generator where I've modified the generator to output the desired union type for data to match the XOR<...>.

    Prisma information

    Environment & setup

    • OS: Mac OS
    • Database: PostgreSQL
    • Node.js version: 16.15.1

    Prisma Version

    prisma                : 2.30.3
    @prisma/client        : 2.30.3
    Current platform      : darwin-arm64
    Query Engine (Binary) : query-engine b8c35d44de987a9691890b3ddf3e2e7effb9bf20 (at node_modules/@prisma/engines/query-engine-darwin-arm64)
    Migration Engine      : migration-engine-cli b8c35d44de987a9691890b3ddf3e2e7effb9bf20 (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
    Introspection Engine  : introspection-core b8c35d44de987a9691890b3ddf3e2e7effb9bf20 (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
    Format Binary         : prisma-fmt b8c35d44de987a9691890b3ddf3e2e7effb9bf20 (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
    Default Engines Hash  : b8c35d44de987a9691890b3ddf3e2e7effb9bf20
    Studio                : 0.423.0
    
    
    bug 
    opened by scottyeck 5
  • Bad prisma-client import

    Bad prisma-client import

    Bug description

    Generated object schemas have a bad prisma-client import when client output is "../src/generated/prisma-client" and zod output is "../src/generated/zod" in Windows:

    import type { Prisma } from '......prisma-client';
    

    How to reproduce

    1. add output = "../src/generated/prisma-client" to client generator config in schema.prisma
    2. add output = "../src/generated/zod" to zod generator config in schema.prisma
    3. Run yarn prisma generate
    4. Go to src\generated\zod\schemas\objects\XCreateInput.schema.ts
    5. See import type { Prisma } from '......prisma-client';

    Expected behavior

    import type { Prisma } from '../../../prisma-client';

    Prisma information

    generator client { provider = "prisma-client-js" output = "../src/generated/prisma-client" binaryTargets = ["native", "rhel-openssl-1.0.x"] }

    generator zod { provider = "prisma-zod-generator" output = "../src/generated/zod" }

    datasource db { provider = "mongodb" url = env("DATABASE_URL") }

    model X { id String @id @default(auto()) @map("_id") @db.ObjectId }

    Environment & setup

    • OS: Windows
    • Database: Mongo
    • Node.js version: v18.6.0

    Prisma Version

    prisma                  : 4.1.0
    @prisma/client          : 4.1.0
    Current platform        : windows
    Query Engine (Node-API) : libquery-engine 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules\@prisma\engines\query_engine-windows.dll.node)
    Migration Engine        : migration-engine-cli 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules\@prisma\engines\migration-engine-windows.exe)
    Introspection Engine    : introspection-core 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules\@prisma\engines\introspection-engine-windows.exe)
    Format Binary           : prisma-fmt 8d8414deb360336e4698a65aa45a1fbaf1ce13d8 (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
    Default Engines Hash    : 8d8414deb360336e4698a65aa45a1fbaf1ce13d8
    Studio                  : 0.467.
    
    bug 
    opened by altarrok 5
  • Validation prevents multiple relationship actions

    Validation prevents multiple relationship actions

    Bug description

    In order to do a nested upsert/set of N-to-Many entities, one needs to tell prisma to do something like this:

    ctx.prisma.entity.update({
      where: { id },
      data: {
        nestedEntities: {
          deleteMany: {
            parentId: id,
          },
          createMany: {
            data: [{...}]
          },
        },
      },
    })
    

    (e.g. https://github.com/prisma/prisma/issues/2255#issuecomment-683811551)

    The deleteMany removes all the nested entities, and then the createMany creates all of them again. While this doesn't seem to be terribly efficient, I don't know of another way to handle a nested N-to-Many write in which you may be adding and updating existing entities.

    ...But, this generator prevents one from specifying more than one verb in a given data object by outputting validation like this:

    const Schema: z.ZodType<Prisma.NestedEntityUpdateManyWithoutParentEntityNestedInput> =
      z.union([
        z
          .object({
            deleteMany: z
              .union([
                z.lazy(() => NestedEntityScalarWhereInputObjectSchema),
                z.lazy(() => NestedEntityScalarWhereInputObjectSchema).array(),
              ])
              .optional(),
          })
          .strict(),
        z
          .object({
            createMany: z
              .lazy(() => NestedEntityCreateManyParentEntityInputEnvelopeObjectSchema)
              .optional(),
          })
          .strict(),
         ...
    ])
    

    which is a union of single attribute objects. The resultant validation error is something like this:

    Failure to save filter TRPCClientError: [
      {
        "code": "unrecognized_keys",
        "keys": [
          "deleteMany",
          "createMany"
        ],
        "path": [
          "create",
          "filters"
        ],
        "message": "Unrecognized key(s) in object: 'deleteMany', 'createMany'"
      },
    ...
    ]
    

    How to reproduce

    Attempt to use more than one verb for a nested entity, e.g. deleteMany and createMany.

    Expected behavior

    Verbs like deleteMany and createMany can be used together.

    Prisma information

    n/a

    Environment & setup

    • OS: MacOS
    • Database: PostgreSQL
    • Node.js version: v16.15.1

    Prisma Version

    prisma                  : 4.6.1
    @prisma/client          : 4.6.1
    Current platform        : darwin
    Query Engine (Node-API) : libquery-engine 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
    Migration Engine        : migration-engine-cli 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/migration-engine-darwin)
    Introspection Engine    : introspection-core 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/introspection-engine-darwin)
    Format Binary           : prisma-fmt 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/prisma-fmt-darwin)
    Format Wasm             : @prisma/prisma-fmt-wasm 4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32
    Default Engines Hash    : 694eea289a8462c80264df36757e4fdc129b1b32
    Studio                  : 0.476.0
    
    bug 
    opened by kristinlindquist 4
  • Include support

    Include support

    Hi @omar-dulaimi Thanks for creating this useful package. This is my first contribution to an open-source project. Hope my PR will be good enough to contribute to this project.

    Here are the things I have added or changed to make things work.

    • I added isGenerateInclude flag to control include field on schema. The default value of the flags is false. Screenshot from 2022-11-05 02-41-13

    • Since we have now two flags (select and include), I am required to move the generateModelArgsInputObjectTypes function from select-helpers to a newly created file modelArgs-helpers. Because schemas/objects/{model}Args files should be generated if any of the two flags is active.

    • Previously we were generating _count field whenever we found a model with manyRelation. But since the isGenerateSelect could be false, we will now add {model}CountOutputTypeArgs field in _count only if the isGenerateSelect flag is true. Screenshot from 2022-11-05 02-42-49

    opened by Shahidul1004 4
  • Added support for BigInt

    Added support for BigInt

    Description

    Currently Prisma's BigInt is not parsed. For instance if we extend the Post model with likes:

    model Post {
      id        Int      @id @default(autoincrement())
      createdAt DateTime @default(now())
      updatedAt DateTime @updatedAt
      title     String
      content   String?
      published Boolean  @default(false)
      viewCount Int      @default(0)
      author    User?    @relation(fields: [authorId], references: [id])
      authorId  Int?
      likes     BigInt
    }
    

    One of the results is:

    const Schema: z.ZodType<Prisma.PostCreateInput> = z
      .object({
        createdAt: z.bigint().optional(),
        updatedAt: z.bigint().optional(),
        title: z.string(),
        content: z.union([z.string(), z.bigint()]).optional().nullable(),
        published: z.bigint().optional(),
        viewCount: z.number().optional(),
        author: z.bigint().optional(),
      })
      .strict();
    
    export const PostCreateInputObjectSchema = Schema;
    

    With the proposed fix, the schema now includes likes:

    const Schema: z.ZodType<Prisma.PostCreateInput> = z
      .object({
       // ...
        author: z.bigint().optional(),
        likes: z.bigint(),
      })
      .strict();
    

    To test the fix, simply run npm run gen-example and inspect the file prisma/generated/schemas/objects/PostCreateInput.schema.ts.

    enhancement 
    opened by carloschida 4
  • [Error] Strange `ERROR undefined` with `trpc` and `nuxt`

    [Error] Strange `ERROR undefined` with `trpc` and `nuxt`

    Bug description

    When using generated zod types with trpc and nuxt nitro server prints strange info.

    Screenshot_20230102_215640

    How to reproduce

    1. Create nuxt
    2. add trpc-nuxt
    3. generate prisma-zod-generator
    4. User generated zod type in input for trpc
    5. Check console for nitro server

    Expected behavior

    There should be no error

    Prisma information

    generator client {
      provider        = "prisma-client-js"
      previewFeatures = ["extendedWhereUnique", "filteredRelationCount", "orderByNulls"]
    }
    
    generator zod {
      provider          = "prisma-zod-generator"
      output            = "./generated/zod"
      isGenerateSelect  = false
      isGenerateInclude = false
    }
    
    // generator trpc {
    //   provider           = "prisma-trpc-generator"
    //   output             = "./generated/trpc"
    //   contextPath        = "../context"
    //   withMiddleware     = false
    //   withShield         = false
    //   isGenerateSelect   = false
    //   isGenerateInclude  = false
    // }
    
    datasource db {
      provider     = "postgresql"
      url          = env("DATABASE_URL")
      relationMode = "foreignKeys"
    }
    
    
    model City {
      id              Int             @id @default(autoincrement())
      title           String          @unique
      createdAt       DateTime        @default(now()) @map("created_at") @db.Timestamptz
      updatedAt       DateTime        @default(now()) @map("updated_at") @db.Timestamptz
      venues          Venue[]
    
      @@map("city")
    }
    
    model Venue {
      id        Int      @id @default(autoincrement())
      code      String   @unique
      title     String   @unique
      address   String
      capacity  Int
      available Boolean  @default(true)
      cityId    Int      @map("city_id")
      createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
      updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
      city      City     @relation(fields: [cityId], references: [id])
      
      @@map("venue")
    }
    

    Environment & setup

    • OS: KDE
    • Database: PostgreSQL
    • Node.js version: v19.3.0

    Prisma Version

    prisma                  : 4.8.0
    @prisma/client          : 4.8.0
    Current platform        : debian-openssl-3.0.x
    Query Engine (Node-API) : libquery-engine d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
    Migration Engine        : migration-engine-cli d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
    Introspection Engine    : introspection-core d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/introspection-engine-debian-openssl-3.0.x)
    Format Binary           : prisma-fmt d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/prisma-fmt-debian-openssl-3.0.x)
    Format Wasm             : @prisma/prisma-fmt-wasm 4.8.0-61.d6e67a83f971b175a593ccc12e15c4a757f93ffe
    Default Engines Hash    : d6e67a83f971b175a593ccc12e15c4a757f93ffe
    Studio                  : 0.479.0
    Preview Features        : orderByNulls, filteredRelationCount, extendedWhereUnique
    
    opened by mubaidr 1
  • Do not expliclity type generated schemas

    Do not expliclity type generated schemas

    Typing them explicitly with ZodType removes some features from the generated schemas.

    For example, ZodType lacks features from ZodObject such as .pick, or .merge.

    Others have stumbled upon this issue as well, for example, https://github.com/omar-dulaimi/prisma-zod-generator/discussions/24 and https://github.com/omar-dulaimi/prisma-zod-generator/issues/25 bring this up. In https://github.com/omar-dulaimi/prisma-zod-generator/issues/25#issuecomment-1294673830 someone brings up that the change I made broke something in the generator for them. In my case, nothing broke - but this could of course have unwanted side effects. In my understanding, ZodObject extends ZodType, which reduces the risk of issues.

    But I am really not sure about this.

    opened by hco 1
  • Doesn't work with fieldReference

    Doesn't work with fieldReference

    Bug description

    With field reference enabled the reference schemas are not generated. Take a look at BoolFilter.schema.ts

    How to reproduce

    Add previewFeatures = ["fieldReference"] to schema.prisma

    Expected behavior

    No response

    Prisma information

    Environment & setup

    • OS:
    • Database:
    • Node.js version:

    Prisma Version

    
    
    opened by Brettm12345 0
  • More granual control over what gets generated, excludeable fields and multiple exported schemas

    More granual control over what gets generated, excludeable fields and multiple exported schemas

    Problem

    This is a three part feature request

    This is a great package and I really want it to succeed but there are some really irritating issues that need features to resolve them.

    1: More granular control over what gets generated

    I posted this issue on your prisma tRPC generator but it seems more relevant here and I'm going to add a bit more detail here on why it's needed and a more detailed solution. A major feature that's lacking from this package is the lack of granularity with what gets generated. For example, our app has about 8 different routes. Only 4 need full CRUD functionality, the rest are mainly for reading, and creation, deletion and update are manually handled by employees using prisma studio. The number of schemas and objects generated by this generator is ludicrous, most simply won't be needed for most use cases. This also makes integrating the codegen process into the development process slower, as you need to manually remove the unnecessary files or manually select all of the useful while leaving the bloat, both of which require with developer time or code to maintain. You should just be able to get what you actually need to use in as close to the way you need to use it as possible. Having more granular control is important to increase the adoption of this package as it will mean people can use it more flexible and generate only what they need for their specific use case

    2: Excludeable fields

    On this note, some fields are not relevant to the Prisma client and don't need to be type checked. For example, we may have an optional field on the backend for administrative purposes that is manually inputted and checked by our employees and is never going to be submitted by Prisma client, so it just gets in the way being there. This isn't that much of an issue for the prisma client but it is for using tRPC with Zod, and this is one of the biggest issues. The generated schema becomes practically useless as it can't be used to automatically validate incoming requests to tRPC because it contains fields that are never going to be submitted by the client. You have to either then manually edit and cut fields from the schema, which detracts from the usefulness of the codegen in the first place, or add a bunch of omits to the object in the tRPC procedure input, which again isn't ideal, especially if the model has a relation and hence is a z.ZodSchema not a z.object so you can't use omit.

    Having control over what fields get generated is crucial for allowing the generation of useful Zod schema. Having complete Prisma schema for every Prisma model and client action is relatively useless if you can't then use those to validate the input your client will actually be sending to your tRPC endpoint. Just one more example here as to why it's necessary, for example, our user may send information like their name, email, address, etc. but will not send things like their user type, which is conditionally added at the API level. However, the generated schema will just fail the request as not being valid because it doesn't contain the user type, which can't be conditional as it is needed in later steps. This leads nicely onto my next point

    3: Multiple exported schemas per Model

    Given that the creator of this package also manages various tRPC, Zod and Prisma related packages, it seems worthwhile to point out that the main schemas generated by this package won't be that useful for most client's inputs coming into tRPC. Not everyone will be sending their data exactly as it will be stored in the database in their request from the client, so as I stated above, these schemas are not hugely useful or need heavy editing. One potential remedy for this is adding the option to generate two schemas for specific Prisma models, one for Prisma client validation and one for tRPC input validation. I'll explain more below

    Suggested solution

    Adding a config file

    I'm not particularly well versed on the Prisma schema syntax and how it interacts with generators. In an ideal world something like the below would be great

    {
          modelName: {
                 createOne: true,
                 createMany: false,
                 findUnique: true,
                 ....
          }
    }
    

    However, just at a glance I doubt prisma's schema will allow json objects. I'm not sure if you can even do nesting, something like a YAML like syntax could work if that's possible like

    modelName:
          createdOne: true
          createMany: false
          findUnique: true
    

    But, these likely both won't work. Perhaps, one way around this might be to have a separate config file that that is assigned in the prisma.schema and passed to the actual generator file

    generator zod {
      provider          = "prisma-zod-generator"
      output            = "./generated-zod-schemas"
      config             = "./zod-generator.json" // zod generator config path goes here
      isGenerateSelect  = true
      isGenerateInclude = true
    }
    

    I think this is likely the root of solving all three issues. You pass in your input as a json object, or maybe as yaml, and this is used to conditional transform your code into the correct output. For example,

    {
        "models": {
            "User": {
                "generate": true, // potentially redundant
                "prisma": {
                    "removeFields": ["createdAt"] // those included are removed
                    "includeMethods": ["createdOne"] // only those included are generated
                },
                "trpc": {
                    "removeFields": ["createdAt", "userType"] // those included are removed
                }
            }
            "Account": {
                "generate": false // prevents schema model from being generated
            }
            ...moreModels
        },
        ...additionalOptions
    }
    

    This is by no means perfect and there's a lot of room to improve the syntax. One potential compliant is that this separates the logic from the prisma.schema, which personally I prefer, as after using zod-prisma, all the comments clog up the file pretty fast. This obviously doesn't include anything about how this would actually be done by the generator, which I imagine is the actual hard part but hopefully this is a helpful start

    Additional context

    If you can provide some guidance, I'd be happy to assist with some of this

    enhancement 
    opened by callum-gander 1
  • Pure model schema?

    Pure model schema?

    Problem

    Does this library generate pure model schema? It should be, for example, the output of findUnique (not the argument of findUnique). I try to find this, but cannot find any file having such thing (probably missed in tons of files).

    Suggested solution

    Just generate the zod based on the model itself. Similar to the output of zod-prisma.

    enhancement 
    opened by lilingxi01 5
Releases(0.8.11)
  • 0.8.11(Jan 1, 2023)

    What's Changed

    • Support Bytes type by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/69

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.10...0.8.11

    Source code(tar.gz)
    Source code(zip)
  • 0.8.10(Dec 31, 2022)

    What's Changed

    • Support extended whereUniqueInput by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/68

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.9...0.8.10

    Source code(tar.gz)
    Source code(zip)
  • 0.8.9(Dec 31, 2022)

  • 0.8.8(Dec 30, 2022)

    What's Changed

    • Update all packages by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/67

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.7...0.8.8

    Source code(tar.gz)
    Source code(zip)
  • 0.8.7(Dec 30, 2022)

    What's Changed

    • Fix data args for createMany by @Feelixe-tin in https://github.com/omar-dulaimi/prisma-zod-generator/pull/60

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.6...0.8.7

    Source code(tar.gz)
    Source code(zip)
  • 0.8.6(Dec 24, 2022)

    What's Changed

    • Feat export all schemas in index by @Feelixe-tin in https://github.com/omar-dulaimi/prisma-zod-generator/pull/54

    New Contributors

    • @Feelixe-tin made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/54

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.5...0.8.6

    Source code(tar.gz)
    Source code(zip)
  • 0.8.5(Dec 24, 2022)

    What's Changed

    • Fix schema generation for prisma preview feature - fullTextSearch/fullTextIndex by @Shahidul1004 in https://github.com/omar-dulaimi/prisma-zod-generator/pull/62

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.3...0.8.5

    Source code(tar.gz)
    Source code(zip)
  • 0.8.3(Dec 24, 2022)

    What's Changed

    • docs: correct link in table of contents by @alitnk in https://github.com/omar-dulaimi/prisma-zod-generator/pull/56
    • Union Update/ Create/ Upsert input object schemas with Unchecked by @scottyeck in https://github.com/omar-dulaimi/prisma-zod-generator/pull/63

    New Contributors

    • @alitnk made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/56
    • @scottyeck made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/63

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.2...0.8.3

    Source code(tar.gz)
    Source code(zip)
  • 0.8.2(Dec 2, 2022)

    What's Changed

    • Modify addFinalWrappers function by @Shahidul1004 in https://github.com/omar-dulaimi/prisma-zod-generator/pull/51

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.1...0.8.2

    Source code(tar.gz)
    Source code(zip)
  • 0.8.1(Dec 2, 2022)

    What's Changed

    • remove .optional from orderby by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/55

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.8.0...0.8.1

    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Nov 28, 2022)

    What's Changed

    • Exclude models and related fields by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/42

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.7.4...0.8.0

    Source code(tar.gz)
    Source code(zip)
  • 0.7.4(Nov 17, 2022)

    What's Changed

    • fix orderby type by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/40

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.7.3...0.7.4

    Source code(tar.gz)
    Source code(zip)
  • 0.7.3(Nov 17, 2022)

    What's Changed

    • Fix bug aggregate operation when Model has only string by @Revitate in https://github.com/omar-dulaimi/prisma-zod-generator/pull/35

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.7.2...0.7.3

    Source code(tar.gz)
    Source code(zip)
  • 0.7.2(Nov 15, 2022)

    What's Changed

    • readme update to include flag by @Shahidul1004 in https://github.com/omar-dulaimi/prisma-zod-generator/pull/39

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.7.1...0.7.2

    Source code(tar.gz)
    Source code(zip)
  • 0.7.1(Nov 15, 2022)

    What's Changed

    • Fixed bug: include no longer generated for models that do not have relations with other models by @BitPhoenix in https://github.com/omar-dulaimi/prisma-zod-generator/pull/38

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.7.0...0.7.1

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Nov 9, 2022)

    What's Changed

    • Include support by @Shahidul1004 in https://github.com/omar-dulaimi/prisma-zod-generator/pull/33

    New Contributors

    • @Shahidul1004 made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/33

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.6.1...0.7.0

    Source code(tar.gz)
    Source code(zip)
  • 0.6.1(Nov 4, 2022)

    What's Changed

    • Fix error type name for OrderByAggregateInput by @Revitate in https://github.com/omar-dulaimi/prisma-zod-generator/pull/32

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.6.0...0.6.1

    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(Nov 4, 2022)

    What's Changed

    • Refactor + select support by @BitPhoenix in https://github.com/omar-dulaimi/prisma-zod-generator/pull/28

    New Contributors

    • @BitPhoenix made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/28

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.5.4...0.6.0

    Source code(tar.gz)
    Source code(zip)
  • 0.5.4(Oct 31, 2022)

    What's Changed

    • Fix missing aggregation field by @Revitate in https://github.com/omar-dulaimi/prisma-zod-generator/pull/27

    New Contributors

    • @Revitate made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/27

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.5.3...0.5.4

    Source code(tar.gz)
    Source code(zip)
  • 0.5.3(Sep 5, 2022)

    What's Changed

    • Fix-generating-mongodb-raw-queries by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/19

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.5.2...0.5.3

    Source code(tar.gz)
    Source code(zip)
  • 0.5.2(Sep 4, 2022)

    What's Changed

    • strict() on zod objects within union by @kristinlindquist in https://github.com/omar-dulaimi/prisma-zod-generator/pull/17

    New Contributors

    • @kristinlindquist made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/17

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.5.1...0.5.2

    Source code(tar.gz)
    Source code(zip)
  • 0.5.1(Aug 13, 2022)

    What's Changed

    • remove postinstall script by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/15

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.5.0...0.5.1

    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Aug 13, 2022)

    What's Changed

    • Added support for BigInt by @carloschida in https://github.com/omar-dulaimi/prisma-zod-generator/pull/14

    New Contributors

    • @carloschida made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/14

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.4.2...0.5.0

    Source code(tar.gz)
    Source code(zip)
  • 0.4.2(Aug 11, 2022)

    What's Changed

    • fix generating decimal fields by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/12

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.4.1...0.4.2

    Source code(tar.gz)
    Source code(zip)
  • 0.4.1(Jul 30, 2022)

    What's Changed

    • Fix broken prisma-client import on windows by @altarrok in https://github.com/omar-dulaimi/prisma-zod-generator/pull/10

    New Contributors

    • @altarrok made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/10

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.4.0...0.4.1

    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Jul 20, 2022)

    What's Changed

    • handle custom output path of prisma client by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/8

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.3.1...0.4.0

    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Jul 16, 2022)

    What's Changed

    • generate missing createMany schema by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/5

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.3.0...0.3.1

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Jul 12, 2022)

    What's Changed

    • Upgrade-to-prisma-4 by @omar-dulaimi in https://github.com/omar-dulaimi/prisma-zod-generator/pull/3

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/compare/0.2.0...0.3.0

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Jul 12, 2022)

    What's Changed

    • transformer update by @StireArLankar in https://github.com/omar-dulaimi/prisma-zod-generator/pull/1

    New Contributors

    • @StireArLankar made their first contribution in https://github.com/omar-dulaimi/prisma-zod-generator/pull/1

    Full Changelog: https://github.com/omar-dulaimi/prisma-zod-generator/commits/0.2.0

    Source code(tar.gz)
    Source code(zip)
Owner
Omar Dulaimi
Full Stack Software Engineer
Omar Dulaimi
Prisma 2+ generator to emit Joi schemas from your Prisma schema

Prisma Joi Generator Automatically generate Joi schemas from your Prisma Schema, and use them to validate your API endpoints or any other use you have

Omar Dulaimi 26 Dec 24, 2022
Prisma +2 generator to emit a tRPC shield from your Prisma schema

Prisma tRPC Shield Generator Automatically generate a tRPC Shield from your Prisma Schema. Updates every time npx prisma generate runs. Table of Conte

Omar Dulaimi 27 Dec 24, 2022
Prisma 2+ generator to emit fully implemented tRPC routers

Prisma tRPC Generator Automatically generate fully implemented tRPC routers from your Prisma Schema. This includes routers, app router and of course a

Omar Dulaimi 370 Jan 3, 2023
Prisma 2+ generator to emit a JSON file that can be run with json-server

Prisma JSON Server Generator A Prisma generator that automates creating a JSON file that can be run as a server from your Prisma schema. Explore the o

Omar Dulaimi 14 Jan 7, 2023
A simple CLI to generate a starter schema for keystone-6 from a pre-existing prisma schema.

Prisma2Keystone A tool for converting prisma schema to keystone schema typescript This is a proof of concept. More work is needed Usage npx prisma2key

Brook Mezgebu 17 Dec 17, 2022
A crash course on Zod - a schema validation library for TypeScript

Zod Crash Course This Zod crash course will give you everything you ever needed to know about Zod - an amazing library for building type-safe AND runt

Total TypeScript 339 Dec 28, 2022
Schemix allows you to programmatically create Prisma schemas using TypeScript ⌨️

Schemix Schemix let's you programmatically generate Prisma schemas. As Prisma schemas are not inherently segmentable, Schemix acts as a library to aid

Rida F'kih 197 Jan 5, 2023
A NestJS module that allows you use Prisma, set up multiple Prisma services, and use multi-tenancy in each Prisma service.

NestJS Prisma Module Installation To use this package, first install it: npm i @sabinthedev/nestjs-prisma Basic Usage In order to use this package, yo

Sabin Adams 39 Dec 2, 2022
Create a C# .NET core EntityFramework ORM from your schema.prisma file

A note of forewarning to the would-be user... This was a failure. I'm making a note here: huge regret. It's hard to overstate my dissatisfaction. ?? S

Ian Ray 9 Dec 24, 2022
GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages, from standalone APIs to composed schemas (Federation, Stitching)

GraphQL Hive GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages, from standalone APIs to composed schem

Kamil Kisiela 184 Dec 21, 2022
Merge multiple Prisma schema files, model inheritance, resolving name conflicts and timings reports, all in a simple tool.

Prisma Util What is Prisma Util? • How to use? • The configuration file • Support What is Prisma Util? Prisma Util is an easy to use tool that merges

David Hancu 21 Dec 28, 2022
Learn GraphQL by building a blogging engine. Create resolvers, write schemas, write queries, design the database, test and also deploy.

GraphQL Blog graphqlblog.com Learn GraphQL by building a blogging engine. Create resolvers, write schemas, write queries, design the database, test an

GraphQLApps 6 Aug 17, 2022
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Hadmean is an internal tool generator. It is language agnostic, schema driven, extremely customizable, featured packed, user-friendly and has just one installation step.

Hadmean Report a Bug · Request a Feature · Ask a Question Table of Contents About Quick Demo Motivation Why you should try Hadmean Getting Started Pre

Hadmean 344 Dec 29, 2022
Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)

openapi-zod-client Generates a zodios (typescript http client with zod validation) from a (json/yaml) OpenAPI spec (or just use the generated schemas/

Alexandre Stahmer 104 Jan 4, 2023
Wrap zod validation errors in user-friendly readable messages

zod-validation-error Wrap zod validation errors in user-friendly readable messages. Features User-friendly readable messages, configurable via options

Causaly 70 Dec 23, 2022
Zod utilities for Remix loaders and actions.

Zodix Zodix is a collection of Zod utilities for Remix loaders and actions. It abstracts the complexity of parsing and validating FormData and URLSear

Riley Tomasek 172 Dec 22, 2022
Types generator will help user to create TS types from JSON. Just paste your single object JSON the Types generator will auto-generate the interfaces for you. You can give a name for the root object

Types generator Types generator is a utility tool that will help User to create TS Interfaces from JSON. All you have to do is paste your single objec

Vineeth.TR 16 Dec 6, 2022
This is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io)

Alternative Prisma Data Proxy This is a library to alternate and self-host the Prisma Data Proxy (cloud.prisma.io). In order to deploy your project to

AijiUejima 60 Dec 28, 2022