Graphql-code-generator: Generate some inconsistent interfaces

Created on 17 Oct 2018  路  4Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
Apollo template adds and underscore to some ARGS interfaces declarations, but in all others types (no ARGS) works well, e.g extending Node class.

To Reproduce

I have a script in my package.json.

"scripts": { "getTypes": "gql-gen --schema https://cms.com/simple/v1/XXXXXXX --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1MTgwMTk5NzEsImNsaWVudElkIjoiY2l2Z29zNmNqMDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' --template graphql-codegen-apollo-angular-template --out ./server/types.ts" },
When I run it, it generates all the types and queries and so on, but in some interfaces it declares with an underscore but in their references try to find it without underscore.

AllArticlesMetaArgs >> _AllArticlesMetaArgs

````
export type AllArticlesMetaResolver<
R = _QueryMeta,
Parent = any,
Context = any

= Resolver;
export interface _AllArticlesMetaArgs {
filter?: ArticleFilter | null;
orderBy?: ArticleOrderBy | null;
skip?: number | null;
after?: string | null;
before?: string | null;
first?: number | null;
last?: number | null;
}
**AllAssetsMetaArgs >> _AllAssetsMetaArgs**
export type AllAssetsMetaResolver<
R = _QueryMeta,
Parent = any,
Context = any
= Resolver;
export interface _AllAssetsMetaArgs {
filter?: AssetFilter | null;
orderBy?: AssetOrderBy | null;
skip?: number | null;
after?: string | null;
before?: string | null;
first?: number | null;
last?: number | null;
}
````
Expected behavior
Generate the code properly.

Schema/Documents
I have uploaded my schema generating it with the other your's template.

https://mega.nz/#!q7wTDKLa!fpl6anSAOm8p_5trKdAt4A5E5C0snBwID54rWQUx1xg

Environment:

  • OS: Windows 10
  • Codegen: 0.12.6
  • Node: 8.9.4
bug plugins waiting-for-release

All 4 comments

Was this page helpful?
0 / 5 - 0 ratings