Type suffix placed incorrectly in query variables type
Describe the bug
Operation and variables types are incorrectly named when generated with the typesSuffix config option.
To Reproduce
The repro is available here: https://codesandbox.io/s/focused-allen-42r9f?file=/types.ts:655-681.
- My GraphQL schema:
type Query {
user(id: ID!): User!
}
type User {
id: ID!
username: String!
email: String!
}
- My GraphQL operations:
query user {
user(id: 1) {
id
username
email
}
}
- My
codegen.ymlconfig file:
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
config:
withHooks: false
typesSuffix: 'Type'
Expected behavior
The generated type name should be UserQueryType and UserQueryVariablesType but instead it is UserTypeQueryType and UserTypeQueryVariablesType
Environment:
@graphql-codegen/add: 2.0.1@graphql-codegen/cli: 1.19.0@graphql-codegen/typescript: 1.17.11@graphql-codegen/typescript-operations: 1.17.8@graphql-codegen/typescript-react-apollo: 2.0.7graphql: 15.3.0- NodeJS: 10.x
Additional context
There was another bug report in the similar vein which was already resolved: #4687
Hi @jaitd , I managed to fix this issue in: https://github.com/dotansimha/graphql-code-generator/pull/5038
Can you please give the alpha version a try? it's @graphql-codegen/[email protected]
Fixed in @graphql-codegen/[email protected].
Thanks @dotansimha. It works now 😄