Expose the Prisma schema as JSON, including comments and annotations
npm install prisma-json-generator!npm
!GitHub Workflow Status (with branch)
prisma-json-generator is a Prisma Generator to expose into a single file (.ts, .json or .js) all attributes coming from the Prisma Schema, in particular comments and annotations.
- Setup your Prisma project as usual (Get Started With Prisma)
- Install this package
- npm install -D prisma-json-generator
- yarn add -D prisma-json-generator
- pnpm install -D prisma-json-generator
- Modify your Prisma model file
``prisma`
generator json {
provider = "prisma-json-generator"
output = "./schema.ts"
}
npx prisma generate`
- Run
Enjoy !
Special Thanks to @loancrate for his powerful and fast AST parser, and to @luisrudge for
his prisma-generator-fake-data generator which help me bootstrap this project!