Airbnb developed @generateMock, a GraphQL directive that uses LLMs to automatically generate realistic, type-safe mock data for testing and prototyping. The solution combines GraphQL schema validation, product context, and design mockups to produce convincing data without manual effort. Engineers can use @respondWithMock to develop client features before server implementation is complete. The system automatically keeps mocks synchronized with evolving queries through hash-based validation, eliminating the traditional pain points of hand-crafting and maintaining mock data. Over 700 mocks have been generated across Airbnb's platforms since launch.
Table of contents
IntroductionKey challengesGoals@generateMock: Schema + context + LLMs = magicGet Michael Rebello’s stories in your inboxWhat does mock data look like?How it works@respondWithMock: Unblocking client developmentSchema evolution: Keeping mocks truthfulConclusionAcknowledgmentsSort: