dotansimha / dotansimha/graphql-code-generator

documentVariableSuffix doesn't work with client preset

Open
#10,229 0 comments 0 reactions 0 assignees View on GitHub
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/client-preset

### Describe the bug

`documentVariableSuffix` is not respected in the `graphql.ts`, but it is in the `gql.ts`.

I believe this is because `documentVariableSuffix` is not part of the [forwarded config](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/client/src/index.ts#L121-L139) for `graphql.ts`.

### Your Example Website or App

https://codesandbox.io/p/devbox/priceless-water-5p9m3h?workspaceId=ws_Gkwk4Jh3EcjEfvkuEJQn9z

### Steps to Reproduce the Bug or Issue

1. generate the files with the configuration in the codesandbox
2. there is no suffix in `gql/gql.ts`, but there is `Document` in the `gql/graphql.ts`
3. remove `documentVariableSuffix`
4. both `gql/gql.ts` and `gql/graphql.ts` has the `Document` suffix

### Expected behavior

For both `gql/gql.ts` and `gql/graphql.ts` to respect the `documentVariableSuffix`.

### Screenshots or Videos

_No response_

### Platform

- OS: Linux
- `graphql` version: ^16.2.0
- `@graphql-codegen/*` version(s): ^5.0.3

### Codegen Config File

```ts
import { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
schema: "schema.graphql",
documents: "document.graphql",
generates: {
"gql/": {
preset: "client",
config: {
documentVariableSuffix: "",
},
},
},
};

export default config;
```

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.