Graphql-code-generator: codegen does not work for type extensions

Created on 22 Jan 2020  路  7Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug

Codegen does not work when a type is extended.

To Reproduce

Try this SDL snippet on the website:

type Mutation {
  setEmail(id: uuid, email: String): User
}

scalar uuid

type User {
  age: Int!
  email: String!
  id: uuid!
  name: String!
}

extend type Mutation {
  insertUser(age: Int, email: String, name: String): User
}

It codegens this for TypeScript:

export type Maybe<T> = T | null;
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
  ID: string,
  String: string,
  Boolean: boolean,
  Int: number,
  Float: number,
  uuid: any,
};

export type Mutation = {
   __typename?: 'Mutation',
  setEmail?: Maybe<User>,
};


export type MutationSetEmailArgs = {
  id?: Maybe<Scalars['uuid']>,
  email?: Maybe<Scalars['String']>
};

export type User = {
   __typename?: 'User',
  age: Scalars['Int'],
  email: Scalars['String'],
  id: Scalars['uuid'],
  name: Scalars['String'],
};
bug core waiting-for-release

All 7 comments

It's probably and issue with graphql-toolkit.
@wawhal can you please create a reproduction in a repo / codesandbox? We need to see your config, versions and setup in order to fix that.

@dotansimha I am using it programmatically. Although it's not a fork of your codesandbox, I have made my own: https://codesandbox.io/s/node-js-enrkr?fontsize=14&hidenavigation=1&theme=dark

Check out and let me know.

@wawhal I tried 1.11.3-alpha-95fd7d8e.60+95fd7d8e (canary version with latest fixes) and it worked.
https://codesandbox.io/s/node-js-tifys
Could you check it as well?

Awesome. Seems to work.
Any ETA when the fix will be added to stable?

@wawhal For a few days I would say.

Cool @ardatan
You can decide if you wish to keep the issue open till it is merged. I don't mind closing it.

Fixed in v1.12.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotansimha picture dotansimha  路  3Comments

jackhkmatthews picture jackhkmatthews  路  3Comments

iamdanthedev picture iamdanthedev  路  3Comments

fvisticot picture fvisticot  路  3Comments

steebchen picture steebchen  路  3Comments