0.4.0 • Published 1 year ago

graphql-codegen-golang v0.4.0

Weekly downloads
89
License
MIT
Repository
github
Last release
1 year ago

GraphQL Code Generator plugin for generating Golang

Roadmap

  • 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)

Install

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

Usage: codegen.yaml

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

Configuration source is at src/config.ts

NameTypeDefaultDescription
packageNamestringgraphqlName of the generated Golang package.
generateHTTPClientbooleantrueShould an GraphQL HTTP client be generated
0.3.0

1 year ago

0.4.0

1 year ago

0.2.0-alpha.0

2 years ago

0.2.0-alpha.1

2 years ago

0.2.0-beta.0

2 years ago

0.1.4

2 years ago

0.1.2

3 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.0

4 years ago