dotansimha / dotansimha/graphql-code-generator-community
Add "operationDefinitionNameSuffix" option to typescript-graphql-request and typescript-react-query
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
**Is your feature request related to a problem? Please describe.**
The monitoring tools my team uses use operation definition name as the key for their metrics (eg. DB query duration for GetUser). Since we have multiple client apps (web, mobile, etc), sometimes it's difficult to determine which client a problematic query originated from.
**Describe the solution you'd like**
A new option is added to `typescript-graphql-request` and `typescript-react-query` (and others) - `operationDefinitionNameSuffix` (and prefix) which defaults to `""`. If set to eg. `_WEB`, the output gets changed from
```
export const GetUserDocument = gql`
query GetUser($userSlug: citext) {
users(where: {username: {_eq: $userSlug}}) {
display_name
}
}
`
```
to
```
export const GetUserDocument = gql`
query GetUser_WEB($userSlug: citext) {
users(where: {username: {_eq: $userSlug}}) {
display_name
}
}
`
```
**Describe alternatives you've considered**
I tried writing a plugin which would do this, but I'm not familiar enough with how plugins interact with each other to be able to do it without affecting other output.
**Additional context**
N/A
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.