🤖 AI Summary
Airbnb introduced a new GraphQL client directive, @generateMock, and integrated it into their Niobe code generator to automatically produce realistic, type-safe mock data using an LLM-backed pipeline. Engineers add @generateMock (with optional id, hints, and designURL) to operations, fragments, or fields, then run Niobe to emit both JSON mock files and language-specific helper functions (TypeScript/Kotlin/Swift). Niobe builds a compact context for the model — the trimmed query and schema subset, inline docs, design snapshot URLs (produced via an internal API), platform, curated image URLs, and developer hints — and streams a Gemini 2.5 Pro response. The pipeline validates the generated JSON against the GraphQL schema using graphqlSync, returns validation errors to the model, and retries to “self-heal” invalid outputs. Niobe also preserves manual edits on subsequent generations.
This approach solves long-standing pain points: it eliminates tedious hand-crafted mocks, keeps mocks in sync with evolving queries, and unblocks client development. A companion directive, @respondWithMock, lets the client runtime return generated mocks instead of server responses for rapid prototyping. Technically, the system couples LLM creativity with deterministic GraphQL guardrails and curated assets (image URL lists and design snapshots) to avoid hallucinations and produce demo-ready, high-fidelity mocks that integrate directly into engineers’ local workflows.
Loading comments...
login to comment
loading comments...
no comments yet