Skip to content

[GAP-10] Apply various improvements/clarifications to @mock spec#46

Open
rebello95 wants to merge 4 commits into
graphql:mainfrom
rebello95:rebello-gap10-fixes
Open

[GAP-10] Apply various improvements/clarifications to @mock spec#46
rebello95 wants to merge 4 commits into
graphql:mainfrom
rebello95:rebello-gap10-fixes

Conversation

@rebello95
Copy link
Copy Markdown
Contributor

Summary

Fixes spec inconsistencies, tightens language, and cleans up the README FAQ for GAP-10 based on discussions from last week's Working Group Day and this Discord thread.

DRAFT.md

  • Fixed ValidateNoNestedMocks logic: isChildrenMocked used AND when it should use OR, preventing the mocked state from propagating to children
  • Added clarifying note that "No Empty Operation Root Validation" doesn't apply when @mock is on the operation definition itself
  • Clarified error merging semantics: client must append errors to the response array
  • Clarified schema language throughout: mocked fields must be defined locally, but need not be deployed on the server
  • Removed "fields not defined in the schema are skipped during validation" — validation always runs against the client's local schema, which includes not-yet-deployed types
  • Added non-normative note that validation timing (codegen, test suite, on-demand) is implementation-defined

SKILL.md

  • Fixed error example to include a variant id wrapper and required __path__ field (was invalid per the DRAFT's mock file structure)
  • Added __ prefix constraint to mock variant id creation instructions

README.md

  • Removed "Future Proposal" section about random picks from multiple @mock values (contradicts the Order Instability rationale in the same FAQ)
  • Removed "New types are unreachable" rationale from the inline fragment "Why not?" section
  • Condensed "Why isn't array position supported?" from ~130 lines to a concise numbered list of the three core arguments
  • Retitled FAQ sections as questions for consistency
  • Clarified schema language to match DRAFT ("defined locally but not yet deployed")
  • Other minor cleanups

Please review

@magicmark

@rebello95 rebello95 requested a review from magicmark as a code owner May 29, 2026 21:39
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 29, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

rebello95 added 4 commits May 29, 2026 14:40
…ILL.md`

- Fix `ValidateNoNestedMocks` logic (AND -> OR) so mocked state propagates to children
- Add clarifying note that "No Empty Operation Root" doesn't apply to operation-level `@mock`
- Revert auto-numbered steps back to `1.` in `TransformOperation` formal spec
- Fix SKILL.md error example to include variant id wrapper and required `__path__`
- Add `__` prefix constraint to SKILL.md mock variant id instructions
- Retitle inline fragment FAQ section to clarify it explains why the feature is unsupported
- Clarify that mocked fields must be defined locally, not just "not exist"
- Remove "fields not defined in schema are skipped" — validation always uses local schema
- Add non-normative note that validation timing is implementation-defined
- Remove "Future Proposal" section (conflicts with Order Instability rationale)
- Remove "New types are unreachable" section from inline fragment FAQ
- Fix schema language in README to use "defined locally but not yet deployed"
- Clarify error merging: client must append errors array, mock author owns `path`/`location`
- Condense "Why isn't array position supported?" from verbose examples to concise numbered list
- Retitle FAQ sections as questions
- Add `<summary>` to details disclosure
- Remove informal tone (emoji, `:)`, "send a PR")
@rebello95 rebello95 force-pushed the rebello-gap10-fixes branch from 1be304c to 1842a2e Compare May 29, 2026 21:40
@rebello95 rebello95 changed the title [GAP-10] Apply various improvements/clarifications to @mock RFC [GAP-10] Apply various improvements/clarifications to @mock spec May 29, 2026
Comment thread gaps/GAP-10/DRAFT.md
This is valid for both operation-level and field-level `@mock` directives.

The client must merge {"errors"} into the GraphQL server's response if present.
The client must append the contents of {"errors"} to the response's {"errors"}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Open question: I think we probably want the implementer to inject the proper "path" value for each error object at runtime based on the context in which the mock is being used. The alternative would be to have the mock file include the full path in each error, which I think could be odd for fields mocked within fragments. Thoughts?

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