swc-project / swc-project/plugins
`graphql-codegen-client-preset`: support configurable document/fragment variable suffixes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 389
- Forks
- 106
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
The plugin hardcodes "Document" and "FragmentDoc" when generating import identifiers for operations and fragments.
This means if you set documentVariableSuffix: '' in your codegen config (a supported option), the plugin generates mismatched imports - it looks for GetUserDocument but codegen exports GetUser.
The upstream codegen has several options that affect variable names:
documentVariablePrefix/documentVariableSuffixfragmentVariablePrefix/fragmentVariableSuffixdedupeOperationSuffixomitOperationSuffix
None of these are currently configurable in the SWC plugin.
I have a PR ready that adds all six options with backwards-compatible defaults.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the graphql-codegen-client-preset SWC plugin and compare its generated import identifiers with the upstream codegen options listed in the issue. Verify how document and fragment prefixes, suffixes, deduplication, and omitted operation suffixes should affect names. Done means all six options are configurable while preserving the current defaults.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100