Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inline comments cause prisma generate failure #124

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,25 @@ npm install -g yarn
```prisma
generator zod {
provider = "zod-prisma"
output = "./zod" // (default) the directory where generated zod schemas will be saved

relationModel = true // (default) Create and export both plain and related models.
// relationModel = "default" // Do not export model without relations.
// relationModel = false // Do not generate related model

modelCase = "PascalCase" // (default) Output models using pascal case (ex. UserModel, PostModel)
// modelCase = "camelCase" // Output models using camel case (ex. userModel, postModel)

modelSuffix = "Model" // (default) Suffix to apply to your prisma models when naming Zod schemas

// useDecimalJs = false // (default) represent the prisma Decimal type using as a JS number
useDecimalJs = true // represent the prisma Decimal type using Decimal.js (as Prisma does)

imports = null // (default) will import the referenced file in generated schemas to be used via imports.someExportedVariable

// https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
prismaJsonNullability = true // (default) uses prisma's scheme for JSON field nullability
// prismaJsonNullability = false // allows null assignment to optional JSON fields
output = "./zod"
relationModel = true
modelCase = "PascalCase"
modelSuffix = "Model"
useDecimalJs = true
prismaJsonNullability = true
}
```

#### Options
| Field | Type | Default | Description |
|-----------------------|---------|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| output | string | ./zod | The directory where generated zod schemas will be saved |
| relationModel | boolean | true | Create and export both plain and related models. Set to `false` to disable export without relations. |
| modelCase | string | PascalCase | The casing of model names (ex UserModel, PostModel). Set to `camelCase` for (ex userMode, postModel) |
| modelSuffix | string | Model | Suffix to apply to your prisma models when naming Zod schemas |
| useDecimalJs | boolean | false | Represent the prisma Decimal type using Decimal.js (as Prisma does) |
| imports | | null | will import the referenced file in generated schemas to be used via imports.someExportedVariable |
| prismaJsonNullability | boolean | true | Uses prisma's scheme for JSON field nullability https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values |

3. Run `npx prisma generate` or `yarn prisma generate` to generate your zod schemas
4. Import the generated schemas form your selected output location
Expand Down