@juanlatorre/graphql-schema-generator
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

GraphQL-Schema-Generator for Prisma

CI codecov

Generate GraphQL schema (SDL) from Prisma schema using a custom Prisma generator.

This is a fork for personal use, it allows to specify the SCHEMA FILE name.

Getting Started

  1. Install this package in your project using:
// pnpm, npm, or yarn
pnpm install @juanlatorre/graphql-schema-generator
  1. Add the generator to the schema.prisma:
generator graphql {
  provider = "gql-schema-generator"
  createCRUD = "true"
  # output = "./generated" This is default path.
  # customSchema = "schema.graphql" This is default file name.
}
  1. Run npx prisma generate to run the generator

  2. Check schema.graphql in ./prisma/generated 🎉

Custom Rules

You can apply custom rules to manipulate behavior. (Some use cases). See this for example.

Example dir structure

image

Example usage

generator graphql {
  provider = "gql-schema-generator"
  output   = "../src/schemas"
  createCRUD = "true"
  customRules = "../prisma/rules.ts"
}

Example rules code

Contributing

Any contributions are welcome. If you are interested, check out our guidelines.

Readme

Keywords

Package Sidebar

Install

npm i @juanlatorre/graphql-schema-generator

Weekly Downloads

0

Version

0.3.2

License

MIT

Unpacked Size

91.2 kB

Total Files

122

Last publish

Collaborators

  • juanlatorre