Repository navigation
Conversation
…ationSuffix + combine Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019G21LchfGxeMbf2U5bR6cL eddeee888:oss:issue-verify
|
Contributor
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/time |
7.1.1-alpha-20261002102719-90183bed6cbcef428f429066eb879f0bca89f831 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.2.8-alpha-20261002102719-90183bed6cbcef428f429066eb879f0bca89f831 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
6.1.10-alpha-20261002102719-90183bed6cbcef428f429066eb879f0bca89f831 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.1.1-alpha-20261002102719-90183bed6cbcef428f429066eb879f0bca89f831 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.2.1-alpha-20261002102719-90183bed6cbcef428f429066eb879f0bca89f831 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/plugin-helpers |
7.4.1-alpha-20261002102719-90183bed6cbcef428f429066eb879f0bca89f831 |
npm ↗︎ unpkg ↗︎ |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This is a checkpoint PR. It adds a failing test showing that the bug in #11026 is real. It doesn't fix anything yet. The fix will be built on top of this commit.
Related #11026
When
omitOperationSuffix: trueandinlineFragmentTypes: 'combine'are both set, the near-operation-file preset leaves out the import for a fragment that is spread inside another fragment. The test mirrors the reporter's repro:markdown.tshas one gql tag:fragment MarkdownFragment.op.tshas two gql tags:fragment WidgetFragment { title { ...MarkdownFragment } }andquery Ping { ping { ...WidgetFragment } }.The test runs the real preset through
executeCodegenagainst this package's ownsrc.Current failure:
The generated
op.generated.tscontainsexport type WidgetFragment = { title: MarkdownFragment | null };but no import forMarkdownFragment. There's also a control test withomitOperationSuffix: false. It passes and emitsimport { MarkdownFragmentFragment } from './markdown.generated';.Likely root cause (not confirmed yet): with
omitOperationSuffix, a fragment namedMarkdownFragmentgives the same identifier name to its document import and its type import. The preset merges fragment imports from the same file by name only. The Ping source'sdocumententry overwrites the WidgetFragment source'stypeentry.typescript-operations'getImports()then keeps onlykind === 'type'entries, so no import is emitted.Type of change
How Has This Been Tested?
npx vitest --no-watch --project typescript-operations packages/plugins/typescript/operations/tests/ts-documents.near-operation-file.spec.tsgives 1 failed (expected) and 1 passed (the control).This adds
@graphql-codegen/near-operation-file-preset@5.2.2(the version from the issue) as a devDependency oftypescript-operations. The lockfile was updated and deduped withpnpm dedupe.Further comments
Red CI on this PR is expected: the failing test is the checkpoint.
🤖 Generated with Claude Code
https://claude.ai/code/session_019G21LchfGxeMbf2U5bR6cL
Generated by Claude Code