Graphql-code-generator: Missing context type in import statement of generated typescript resolver

Created on 20 Mar 2019  路  3Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
Context type is missing in import statement of generated resolver with module#type syntax in configuration of contextType

To Reproduce
Steps to reproduce the behavior:

  1. Use any schema
  2. Add a a context type in configuration file
# ...
generates:
  path/to/file.ts:
    config:
      contextType: ./context#MyContext
    plugins:
      - typescript-resolvers
  1. Run the following command: graphql-codegen with configuration file

Expected behavior
Generated resolver should have an import statement like

import { MyContext} from './context';

and getting the following (missing the type)

import { } from './context';
bug plugins waiting-for-release

Most helpful comment

Hi @mdaouas , thank you for reporting it.
I created a fix for it: https://github.com/dotansimha/graphql-code-generator/pull/1522
I'll merge and release a new version (1.0.2) once CI passes.

All 3 comments

Hi @mdaouas , thank you for reporting it.
I created a fix for it: https://github.com/dotansimha/graphql-code-generator/pull/1522
I'll merge and release a new version (1.0.2) once CI passes.

Awesome @dotansimha - thanks for the super quick turnaround. I was just coming to report the same thing. :)

Fix available in 1.0.2.

Was this page helpful?
0 / 5 - 0 ratings