dotansimha / dotansimha/graphql-code-generator
Deduping for fragment name suffix (FragmentFragmentDoc)
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Which packages are impacted by your issue?
@graphql-codegen/fragment-matcher
### Describe the bug
Given a simple fragment:
```
/// xxx_fragment.graphql
fragment XXXFragment on YYY {
...
}
```
the following type is generated:
```
XXXFragmentFragmentDoc
```
Is this intended? How can I stop this behaviour? I've set `dedupeOperationSuffix: true` but this does not seem to affect fragments.
### Your Example Website or App
na
### Steps to Reproduce the Bug or Issue
1. Create an `example_fragment.graphql` file
2. Create a basic fragment document in this file (as indicated above)
3. Name the fragment with "Fragment" as suffix
4. generate code
5. generated type has suffix: `FragmentFragmentDoc`
### Expected behavior
A type name should be generated without repeating the "Fragment" text.
### Screenshots or Videos
_No response_
### Platform
- OS: macOS
- NodeJS: v18.1.0
- `graphql` version: 16.6.0
- `@graphql-codegen/*` version(s): 3.0.0
### Codegen Config File
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
schema: "src/api/graphql",
documents: "src/api/graphql/**/*.graphql",
generates: {
"src/api/generated/": {
preset: "client",
config: {
useTypeImports: true,
dedupeOperationSuffix: true,
useIndexSignature: true,
},
plugins: [],
},
},
};
export default config;
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.