Skip to content

Clarify mock transform algorithms#5

Draft
magicmark wants to merge 33 commits into
mock_specfrom
clarify-mock-transform-algorithms
Draft

Clarify mock transform algorithms#5
magicmark wants to merge 33 commits into
mock_specfrom
clarify-mock-transform-algorithms

Conversation

@magicmark

Copy link
Copy Markdown
Owner

Summary

  • clarify TransformOperation so it starts from an operation definition instead of treating SelectionSet nodes as directive-bearing
  • split mocked-selection removal into TransformSelectionSet and keep follow-up pruning as a fixed-point cleanup
  • clarify unused variable removal after mocked selections and fragment pruning
  • fix ValidateNoNestedMocks to propagate mocked-parent state with OR semantics
  • keep fragment expansion readable in pseudocode while noting recursion guards

Notes

This matches the interpretation used by the Apollo Client demo implementation: operation-level @mock bypasses the server, field-level @mock removes the field selection, empty parents/fragments are pruned afterward, and children of a mocked field cannot also use @mock across fragment boundaries.

Validation

  • git diff --check

Draft PR: This PR was sent by Claude and may not have yet been reviewed by markl.

magicmark and others added 30 commits March 8, 2026 15:31
Mock data is always included in the response regardless of @Skip or
@include directives on the same field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a value: String argument to @mock that allows inline scalar mock
values directly in the query without needing a mock file. The value and
variant arguments are mutually exclusive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Co-authored-by: Michael Rebello <me@michaelrebello.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant