Docs: clarify that anonymous codegen operations are silently ignored#3241
Open
morgan-coded wants to merge 1 commit into
Open
Docs: clarify that anonymous codegen operations are silently ignored#3241morgan-coded wants to merge 1 commit into
morgan-coded wants to merge 1 commit into
Conversation
…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>
Contributor
There was a problem hiding this comment.
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.
Author
|
I have signed the CLA! |
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.
WHY are these changes introduced?
Fixes #1997
@shopify/api-codegen-presetonly generates types for named queries andmutations. 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.tswith no error or warning, which is easy to misdiagnose. TheREADME mentioned operations "must have a name" but didn't explain this
silent-failure behavior.
WHAT is this pull request doing?
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?
Type of change
Checklist
pnpm changesetto create a draft changelog entry