dotansimha / dotansimha/graphql-code-generator
Argument Type Name Clash
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
Field argument type names clash with certain naming of fields even though the GraphQL schema is valid.
For example:
`Collection.itemTags` and `CollectionItem.tags` both generate types for arguments with the same name `CollectionItemTagsArgs`.
**To Reproduce**
Steps to reproduce the behavior:
Sandbox with minimal reproduction:
https://codesandbox.io/s/fervent-faraday-1r00d?file=/schema.graphql
1. My GraphQL schema:
```graphql
type Query {
collection(id: ID!): Collection!
}
type Collection {
itemTags(aggregate: Boolean): [String]
}
type CollectionItem {
tags(set: String): [String]
}
```
2. My GraphQL operations:
```graphql
query collection {
collection(id: 1) {
itemTags
}
}
```
3. My `codegen.yml` config file:
```yml
schema: schema.graphql
documents: document.graphql
generates:
types.ts:
plugins:
- typescript
- typescript-operations
```
**Expected behavior**
I expected unique type names to be generated for distinct GraphQL types and field arguments.
**Environment:**
- OS:
- `@graphql-codegen/...`: 1.19.4
- NodeJS: v14.15.1
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.