GraphQL Code Generator

GraphQL Code Generator

  • API & Documentation
  • GitHub
  • Help

›Integrations

Getting Started

  • What is GraphQL Code Generator?
  • Codegen Options Config
  • `schema` field
  • `documents` field
  • `config` field
  • `require` field
  • Lifecycle Hooks
  • Development Workflow
  • Programmatic Usage
  • Further Reading

Plugins

  • Available Plugins
  • TypeScript
  • TypeScript Operations
  • TypeScript 1.0 Compatibility
  • TypeScript Resolvers
  • TypeScript GraphQL Files Modules
  • TypeScript document nodes
  • TypeScript MongoDB
  • TypeScript React Apollo
  • TypeScript Apollo Angular
  • TypeScript Stencil Apollo
  • TypeScript Urql
  • TypeScript GraphQL-Request
  • Flow Types
  • Flow Resolvers
  • Flow Operations
  • Kotlin
  • Java
  • Java Resolvers
  • Java Apollo Android
  • Fragment Matcher
  • Introspection
  • Add
  • Time
  • Schema AST
  • Reason Client
  • Relay Operation Optimizer.

Presets

  • near-operation-file
  • import-types

Integrations

  • Apollo Local State
  • Create-React-App
  • GatsbyJS
  • Prettier & Linters
  • Apollo Federation

Custom Code-Generator Plugins

  • What are Plugins?
  • Write your first Plugin
  • Validate Plugin Configuration
  • How to extend the GraphQL Schema?
  • Visitor Pattern

Migration

  • Migration to 1.0.0
  • Migration from 0.13 to 0.18

GatsbyJS

If you are building apps using GatsbyJS, you can use GraphQL Code Generator to generate TypeScript types.

The codegen knows automatically to look for the import of the graphql tag for gatsby package.

Using the following config file, it should cover everything specific to Gastby:

schema: http://localhost:8000/___graphql
documents:
  - ./src/**/*.{ts,tsx}
  - ./node_modules/gatsby-*/**/*.js
generates:
  ./src/graphqlTypes.ts:
    plugins:
      - typescript
      - typescript-operations

Now, the codegen should be able to load your GraphQL operations from your source code, and also load all the internal fragments from node_modules.

← Create-React-AppPrettier & Linters →
GraphQL Code Generator
githubmediumtwitter
DocsHelp
© Copyrights by The Guild, all rights reserved
© The Guild 2018
GraphQL Code Generator is licensed under MIT and can be used free of charge with no restrictions