dotansimha / dotansimha/graphql-code-generator
Support using an alternative name for 'DocumentNode' in generated code
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Is your feature request related to a problem? Please describe.
We happen to have a type in our GraphQL schema named `DocumentNode`. This presents a problem for us, because the generated code is invalid. It contains a duplicate definitions of this name.
The generated code is as follows:
```
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
```
### Describe the solution you'd like
Ideally, the code generator should detect the problem, and generate a unique name.
Alternatively, provide a config option to override the name of the alias.
### Describe alternatives you've considered
I've tried to patch the generator code (using something like `pnpm patch`). It turns out there are multiple packages involved that needs to be patched:
- @graphql-codegen/typed-document-node
- @graphql-codegen/visitor-plugin-common
I think this solution will work, but it's inconvenient.
### Is your feature request related to a problem? Please describe.
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.