Opens in a new tab

A Mock Is a Promise: Making GraphQL Mocks Enforceable

19 Aug 2026

Bengaluru, India

Speaker
Yogesh Nikam
Share this page

Summary

GraphQL mocks help frontend teams start before the API implementation is ready. But this creates a dangerous question: when the real service arrives, who verifies that it fulfils the promise made by the mock?
In this session, I will demonstrate a contract-first workflow where the same GraphQL SDL and examples serve two purposes. Before implementation, Specmatic turns them into a standalone GraphQL mock against which the frontend can develop and test. After implementation, Specmatic uses that same contract to test the real GraphQL service.
The demo follows a realistic failure. A frontend works correctly against the agreed mock, but the real GraphQL resolver incorrectly maps fields returned by a downstream REST service. The GraphQL schema remains valid, yet the frontend receives an HTTP 200 response containing GraphQL errors and unusable data.
We will reproduce this failure, catch it through contract tests, fix the resolver, and place the verification in CI as a release gate. The downstream dependency will be isolated using an OpenAPI-backed mock, allowing us to test the real resolver behaviour without requiring a shared integration environment.
The central idea is simple: mocks move feedback earlier, but provider verification prevents that early feedback from becoming fiction.

Other Appearances