https://github.com/zackradisic/prisma2gql
prisma schema 2 graphql schema generator
https://github.com/zackradisic/prisma2gql
Last synced: 5 months ago
JSON representation
prisma schema 2 graphql schema generator
- Host: GitHub
- URL: https://github.com/zackradisic/prisma2gql
- Owner: zackradisic
- Created: 2022-05-10T18:45:38.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-30T13:51:32.000Z (about 4 years ago)
- Last Synced: 2025-02-28T04:24:27.172Z (over 1 year ago)
- Language: Haskell
- Size: 13.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# prisma2gql
simple lil graphql code generator 4 prisma schema files
## setup
1. install nix
2. run `nix-shell` in the root project directory
3. run `cabal update`
3. run `cabal install` this should install `prisma2gql` to `~/.cabal/bin/prisma2gql` so add it to your path
## usage
```
Usage: prisma2gql [--schema ARG] [--template ARG] [--out ARG]
Generate a GraphQL schema from a Prisma schema
Available options:
--schema ARG Path to Prisma schema file
--template ARG Path to template
--out ARG Path for output generate gql schema
-h,--help Show this help text
```
## example
You can comment a field with `@gql-optional` to make the field optional in the GraphQL schema, but remain required in the
prisma schema.
You can comment a field with `@gql-ignore` to omit the field from the graphql schema.
```prisma
model Person {
id Int @id @default(autoincrement())
// @gql-optional
email String
// @gql-ignore
secondsLived BigInt
}
```
this will output:
```graphql
type Person {
id: Int!
email: String
}
```