Skip to content

Add inline value argument to @mock#4

Merged
magicmark merged 2 commits into
mock_specfrom
mock-inline-value
Mar 13, 2026
Merged

Add inline value argument to @mock#4
magicmark merged 2 commits into
mock_specfrom
mock-inline-value

Conversation

@magicmark

Copy link
Copy Markdown
Owner

Summary

  • Adds a value: String argument to @mock that provides inline scalar mock values directly in the query, without consulting a mock file
  • variant and value are mutually exclusive — exactly one must be provided
  • value is restricted to leaf types (scalars and enums) only; cannot be used on object fields or operation roots
  • The client coerces the string to the field's expected scalar type (e.g. "42"Int, "true"Boolean)

Example

query GetBusinessInfo {
  business(id: "123") {
    name @mock(value: "The Great British Bakery")
    rating @mock(value: "4.5")
    isOpen @mock(value: "true")
    hours @mock(variant: "morning-only") {
      open
      close
    }
  }
}

Spec sections changed

  • Directive definition: Added value: String argument
  • Arguments (new section): Documents both args, mutual exclusivity rule
  • Returning Mock Data: Updated to describe resolution from inline values
  • Mock Files: Exempts value-only operations from requiring a mock file
  • Inline Value Validation (new section): Validation rules for the value argument
  • Overview: Added inline value example

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>
@magicmark
magicmark merged commit 317e427 into mock_spec Mar 13, 2026
magicmark added a commit that referenced this pull request Jul 1, 2026
Adds a dedicated workflow and script that enforces new GAP metadata.yml
files have their `id` field set to the PR number, per CONTRIBUTING.md.

Only runs on pull requests that add a new metadata.yml. Would have
caught the issue in #4 where id was set to 2 instead of 4.

Co-Authored-By: Claude <noreply@anthropic.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