A Prisma generator that creates TypeScript class definitions from your Prisma schema, primarily for use with NestJS decorators like @nestjs/swagger and TypeGraphQL. Current version 0.2.11 generates per-model classes with optional separate relational fields. It integrates into the Prisma generate workflow, automatically producing classes that mirror the Prisma model structure. Key differentiator: bridges Prisma's type-only output with NestJS's class- and decorator-based ecosystem, reducing boilerplate when using swagger or GraphQL decorators. Release cadence is sporadic, last updated 2021.
npm install prisma-class-generatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates adding the generator to schema.prisma, generating classes, and using a generated class in a NestJS DTO with swagger decorators.
Run 'npx prisma generate' after editing schema.prisma.
Configure output path in generator options, e.g., output = "../src/generated/classes".
Check generated files for completeness; manually define classes for models with unsupported types.
Upgrade to version 0.2.0 or later to use separateRelationFields option.
Add custom validation (e.g., class-validator decorators) as needed.
Install the package: npm install prisma-class-generator. Ensure generator block uses 'provider = "prisma-class-generator"'.
Run 'npm install prisma-class-generator' in your project.
Adjust import path to match the actual generated file location, check generator output option.
Use 'declare' keyword or re-define properties with public access modifier.
Manually define Json field type as 'Prisma.JsonValue' or use a wrapper type.
No dependency data recorded yet.