Skip to content

Docs: clarify that anonymous codegen operations are silently ignored#3241

Open
morgan-coded wants to merge 1 commit into
Shopify:mainfrom
morgan-coded:docs/1997-codegen-anonymous-operations
Open

Docs: clarify that anonymous codegen operations are silently ignored#3241
morgan-coded wants to merge 1 commit into
Shopify:mainfrom
morgan-coded:docs/1997-codegen-anonymous-operations

Conversation

@morgan-coded
Copy link
Copy Markdown

WHY are these changes introduced?

Fixes #1997

@shopify/api-codegen-preset only generates types for named queries and
mutations. Anonymous operations are counted as documents — so they don't trigger
the "no documents to parse" error — but they're skipped during generation. A
project containing only anonymous operations therefore produces an empty
*.generated.d.ts with no error or warning, which is easy to misdiagnose. The
README mentioned operations "must have a name" but didn't explain this
silent-failure behavior.

WHAT is this pull request doing?

  • Expands the note in the README's "Generating types" section to explain that
    anonymous operations are silently skipped (no error, empty output), and adds a
    short named-vs-anonymous example.

No code changes — this is the upstream graphql-codegen behavior; this PR just
documents it.

How was this verified?

  • README-only change; no new links added (markdown link check unaffected).
  • Confirmed against the package's own fixtures, which use only named operations.

Type of change

  • Patch: Bug (non-breaking change which fixes an issue) — documentation fix
  • Minor: New feature
  • Major: Breaking change

Checklist

  • I have used pnpm changeset to create a draft changelog entry
  • I have added/updated tests for this change — n/a (docs only)
  • I have documented new APIs/updated the documentation for modified APIs

…ed (fixes Shopify#1997)

The README's note that operations "must have a name" did not explain the
silent-failure mode reported in Shopify#1997: anonymous operations are counted as
documents (so they don't trigger the "no documents" error) but are skipped
during generation, so a project with only anonymous operations produces an
empty *.generated.d.ts with no warning. Expand the note with this behavior
and a named-vs-anonymous example so users don't lose time to an empty output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 29, 2026 15:14
@github-actions github-actions Bot added cla-needed devtools-gardener Post the issue or PR to Slack for the gardener labels May 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the @shopify/api-codegen-preset documentation to clarify that anonymous GraphQL operations are treated as documents but are ignored during type generation, which can result in empty generated typings without an error.

Changes:

  • Expand README guidance with an “IMPORTANT” callout explaining why named operations are required for type generation.
  • Add an example contrasting anonymous vs. named operations and the resulting codegen behavior.
  • Add a changeset to publish the documentation clarification as a patch update.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/api-clients/api-codegen-preset/README.md Documents that anonymous operations are silently skipped and provides a concrete example of named vs. anonymous queries.
.changeset/docs-codegen-anonymous-operations.md Adds a patch changeset noting the README-only documentation update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@morgan-coded
Copy link
Copy Markdown
Author

I have signed the CLA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devtools-gardener Post the issue or PR to Slack for the gardener

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[api-codegen-preset] Types for anonymous operations are not generated / anonymous operations are ignored

2 participants