-
Notifications
You must be signed in to change notification settings - Fork 2
GraphQL Codegen April 2026 update #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eddeee888
wants to merge
7
commits into
main
Choose a base branch
from
add-gcg-major-post
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+81
−0
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5242f4b
WIP add initial draft
eddeee888 d1affe6
Fill out other changes
eddeee888 ba07762
Add callouts and resources
eddeee888 904b86e
Draft
eddeee888 1ea280c
Draft - final?
eddeee888 6bb4870
Fix date
eddeee888 fb2a70b
Use correct callout
eddeee888 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
packages/documentation/content/blog/graphql-codegen-client-v6-202604/index.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| title: GraphQL Codegen Update, April 2026 - Operations and Client Preset v6 | ||
| authors: eddeee888 | ||
| tags: [graphql, graphql-codegen, client, operations, code generation] | ||
| date: 2026-04-30 | ||
| description: GraphQL Codegen April 2026 update brings fundamental changes to how client types work, resulting in less generated code, better type correctness and defaults, fewer dependencies, and simpler setup. | ||
| --- | ||
|
|
||
| import { Callout } from "@hive/design-system/hive-components/callout"; | ||
|
|
||
| [typescript-operations](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-operations) and [client-preset](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) v6 are now available, introducing a major overhaul of how client types are generated. | ||
|
|
||
| - Significantly less generated code | ||
| - Stronger, more accurate types by default | ||
| - Fewer dependencies and a simpler setup | ||
|
|
||
| <Callout type="info"> | ||
| This release is the result of close collaboration between The Guild and [Igor Kusakov](https://www.linkedin.com/in/igor-kusakov-aa19636/) from [Yelp](https://www.yelp.com/), along with thoughtful input from the wider GraphQL community. | ||
|
|
||
| Feel free to reach out with ideas or feedback: [X](https://x.com/eddeee888), [LinkedIn](https://www.linkedin.com/in/eddeee888/), [GraphQL Discord](https://discord.com/channels/625400653321076807/631489733750423599) | ||
|
|
||
| </Callout> | ||
|
|
||
| ## The main change | ||
|
|
||
| Previously, the low-level [`typescript` plugin](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript) generated all schema types, and `typescript-operations` referenced those types for inputs and variables. | ||
|
|
||
| This approach caused a few issues: | ||
|
|
||
| - **All schema types were generated, even if unused** | ||
| Result: large generated files filled with types you never use | ||
| - **Client and server plugins were indirectly coupled** | ||
| Result: slower iteration, as changes risked breaking other use cases | ||
| - **`typescript-operations` setups were manual and easy to get wrong** | ||
| Result: verbose setups and reliance on additional plugins or presets | ||
|
|
||
| With v6, `typescript-operations` and `client-preset` are redesigned around three key ideas: | ||
|
|
||
| - Generate schema types only when they are actually used, instead of generating the entire schema upfront | ||
| - Fully decouple from `typescript` and `typescript-resolvers` | ||
| - Provide better built-in support for common `typescript-operations` setups: one-file, multi-file, and near-operation-file | ||
|
|
||
| Read [about the supported `typescript-operations` setups](https://the-guild.dev/graphql/codegen/docs/migration/operations-and-client-preset-from-5-0#typescript-operations) | ||
|
|
||
| <Callout type="info"> | ||
| [client-preset](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) | ||
| is our recommended setup thanks to its simplicity and flexibility. It builds | ||
| on the improved `typescript-operations` under the hood, so you get all its | ||
| benefits out of the box, with no extra setup. | ||
| </Callout> | ||
|
|
||
| ## Other notable changes | ||
|
|
||
| - Default `client-preset` persisted document hash algorithm is now SHA-256 | ||
| - Improved type correctness and defaults for scalars, `@skip`/`@include`, and field nullability | ||
| - Configuration updates: improved `avoidOptionals`, `enumValues`, and removal of `preResolveTypes` | ||
| - CLI errors no longer fail silently | ||
| - Packages are ESM-first | ||
|
|
||
| Read the [v6 migration guide](https://the-guild.dev/graphql/codegen/docs/migration/operations-and-client-preset-from-5-0) | ||
|
|
||
| ## Bonus: migrating from Apollo Tooling | ||
|
|
||
| GraphQL Codegen now supports migration from [Apollo Tooling](https://github.com/apollographql/apollo-tooling) (`apollo client:codegen`). | ||
|
|
||
| This includes: | ||
|
|
||
| - `near-operation-file` preset compatibility | ||
| - Enum type compatibility | ||
| - Matching type naming conventions | ||
|
|
||
| Existing Apollo Tooling projects can switch with minimal changes. | ||
|
|
||
| Read the [migration guide from Apollo Tooling](https://the-guild.dev/graphql/codegen/docs/migration/apollo-tooling) | ||
|
|
||
| ## Resources | ||
|
|
||
| - [v6 migration guide](https://the-guild.dev/graphql/codegen/docs/migration/operations-and-client-preset-from-5-0) | ||
| - [Apollo Tooling to GraphQL Codegen migration guide](https://the-guild.dev/graphql/codegen/docs/migration/apollo-tooling) | ||
| - [Original RFC](https://github.com/dotansimha/graphql-code-generator/issues/10479) | ||
| - [Feature branch](https://github.com/dotansimha/graphql-code-generator/pull/10496) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date TBD, but should be around this time.