dotansimha / dotansimha/graphql-code-generator-community
typescript-rtk-query support for gqlImport
- 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.**
Our fragments are shared by frontend and backend so we are forced to keep them using `gql` tagged strings from `@apollo/client` The issue is that when the plugin generates the endpoints it will produce a query like this
```
export const SomeMutation = `
mutation SomeQuery($input: SomeMutationInput!) {
someMutation(input: $input) {
...SomeFragment
}
}
${TaggedStringFragment}
`
```
This at the end will result in error on the client which is interpreting the fragment as `[object][object]`
**Describe the solution you'd like**
Like other typescript plugins, supporting `documentMode` and `gqlImport` options will resolve the issue. wrapping the query with `gql` before making request won't solve the issue because it is a tagged string
**Describe alternatives you've considered**
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the typescript-rtk-query plugin and trace how generated endpoints handle documentMode and gqlImport. Done means shared tagged-string fragments no longer become [object Object] in the generated query; the issue names no specific files or tests to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100