dotansimha / dotansimha/graphql-code-generator

[typescript-operations]: inlineFragmentTypes 'inline' with exception list

Open
#9,294 0 comments 8 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Is your feature request related to a problem? Please describe.

We've been using config `inlineFragmentTypes` 'inline' for a long time. We feel it results in fast compilation overall.
However, we have some fragments that are somewhat complex that we use all over the place

Here's an example of one of the fragment

```graphql
fragment TokenizedTextFragment on TokenizedText {
text
tokens: tokens2 {
... on IIToken {
value
}
... on UrlToken {
url
}
... on EmailToken {
email
}
... on AttachmentToken {
attachment {
...AttachmentFragment
}
}
}
}
```

This is the generic fragment on how to resolve our tokenized text.
We've found that not inlining that particular fragment makes a big difference.
However, the current configuration is "all or nothing"

### Describe the solution you'd like

I'd like to be able to turn on `inlineFragmentTypes` to 'inline" but specify a list of fragments to exclude from the inlining process.

Here's my proposed solution, I could open a PR with this if we think this is something we want to add
https://github.com/dotansimha/graphql-code-generator/compare/master...Cellule:graphql-code-generator:inline-fragment-inline-expection?expand=1

### Describe alternatives you've considered

So far none of the combination of options give me what I want.
I've resulted in patching graphql-code-generator in my project to add this feature for a few years already and figured now was time to contribute back as maintaining the patch is tedious and I don't think I'll move away from this solution

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.