You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin previously hardcoded "Document" and "FragmentDoc" suffixes
when generating import identifiers. This meant setting e.g.
`documentVariableSuffix: ''` in codegen config would cause a mismatch.
Adds six new config options matching @graphql-codegen/client-preset:
- documentVariablePrefix (default: "")
- documentVariableSuffix (default: "Document")
- fragmentVariablePrefix (default: "")
- fragmentVariableSuffix (default: "FragmentDoc")
- dedupeOperationSuffix (default: false)
- omitOperationSuffix (default: false)
dedupeOperationSuffix and omitOperationSuffix only affect fragment
variable names, matching upstream codegen's getFragmentVariableName.
All defaults match previous hardcoded values — fully backwards compatible.
Copy file name to clipboardExpand all lines: contrib/graphql-codegen-client-preset/README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,19 @@ You will need to provide the `artifactDirectory` path that should be the same as
16
16
17
17
The plugin also supports a `namingConvention` option to match the naming convention configured in your `codegen.ts`. The default is `"change-case-all#pascalCase"` which matches the default for `@graphql-codegen/client-preset`. If you have set `namingConvention: "change-case-all#upperCaseFirst"` in your `codegen.ts`, you must also set it in the plugin options.
18
18
19
+
#### Variable prefix/suffix options
20
+
21
+
By default the plugin appends `"Document"` to operation names and `"FragmentDoc"` to fragment names when generating import identifiers — matching the `@graphql-codegen/client-preset` defaults. If you've changed these in your codegen config, set the same values here so the plugin generates matching imports.
22
+
23
+
| Option | Default | Description |
24
+
|--------|---------|-------------|
25
+
|`documentVariablePrefix`|`""`| Prefix for operation variable names |
26
+
|`documentVariableSuffix`|`"Document"`| Suffix for operation variable names |
27
+
|`fragmentVariablePrefix`|`""`| Prefix for fragment variable names |
28
+
|`fragmentVariableSuffix`|`"FragmentDoc"`| Suffix for fragment variable names |
29
+
|`dedupeOperationSuffix`|`false`| When `true`, deduplicates overlapping suffix on fragments (e.g. `MyFragment` + `FragmentDoc` → `MyFragmentDoc` instead of `MyFragmentFragmentDoc`) |
30
+
|`omitOperationSuffix`|`false`| When `true`, omits the fragment variable suffix entirely |
0 commit comments