GraphQL Data Mocking at Scale with LLMs and @generateMock
2025-10-30
14 min read
3
by Michael Rebello
Endigest AI Core Summary
Airbnb introduces @generateMock, a GraphQL client directive that uses LLMs to automatically generate realistic, type-safe mock data for testing and prototyping.
- •Engineers add @generateMock to any GraphQL operation, fragment, or field and run their existing Niobe code generator to produce JSON mock files and typed helper functions
- •The directive accepts optional arguments: id for naming, hints for custom instructions (e.g. "Include travel entries for Barcelona"), and designURL to match a Figma mockup
- •Context passed to the LLM includes the query definition, trimmed schema subset with inline docs, design snapshot image, platform target, and a curated list of valid Airbnb image URLs to prevent hallucinated URLs
- •Niobe is fine-tuned against Gemini 2.5 Pro for its 1M token context window and generation speed
- •The system preserves manual edits to generated JSON on subsequent regeneration runs
Tags:
#networking
#llm
#engineering
#graphql
#ai
