- Generate types
- Generate queries and mutations
- Generate subscriptions with gorilla websocket
- Generate Terraform providers
- Generate CLI
- Add more configuration options
- Avoid possible naming collisions
This package generates Golang types from GraphQL schema, and can optionally generate:
- An HTTP client
- A Terraform provider wrapping the generated HTTP client (TODO)
- A cobra CLI wrapping the generated HTTP client (TODO)
The package is published to graphql-codegen-golang.
pnpm add -DE graphql-codegen-golang
yarn add -DE graphql-codegen-golang
npm install -DE graphql-codegen-golang
schema: examples/graphql/schema.graphql
documents: examples/graphql/!(schema).graphql
generates:
examples/graphql/graphql.go:
hooks:
afterOneFileWrite: go fmt
plugins:
- graphql-codegen-golang:
packageName: graphql # default
generateHTTPClient: true # default
See graphql.config.yaml
for more.
Configuration source is at src/config.ts
Name | Type | Default | Description |
---|---|---|---|
packageName | string | graphql | Name of the generated Golang package. |
generateHTTPClient | boolean | true | Should an GraphQL HTTP client be generated |