{"slug": "llm-generated-graphql-mocks-arrive-at-airbnb-and-expedia-while-the-spec-lags", "title": "LLM-Generated GraphQL Mocks Arrive at Airbnb and Expedia, While the Spec Lags Behind", "summary": "Expedia Group has open-sourced mockql-rs, a Rust CLI that generates GraphQL mock responses from an LLM at request time, marking the third public attempt in six months after Airbnb's @generateMock directive and a GraphQL Foundation RFC. The tool parses and validates operations against the schema, forwards real fields upstream, and merges generated data with live backend data, allowing developers to annotate only unfinished fields with @mock and optional hints. The three approaches differ significantly in design, with the RFC requiring clients to return mocks without network requests and LLM generation only as a recommended strategy.", "body_md": "Expedia Group has [open-sourced mockql-rs](https://medium.com/expedia-group-tech/focus-on-the-feature-not-the-fixture-genai-powered-graphql-mocks-ea069670af02), a Rust CLI that generates GraphQL mock responses from an LLM at request time. It is the third public attempt in six months at the same problem, after Airbnb's @generateMock directive in April and a [GraphQL Foundation RFC](https://rfcs.graphql.org/rfcs/MockSpec/) opened in February. The three arrived at markedly different designs, and two of them use the same directive name to mean different things.\n\nThe shared premise is that a GraphQL selection set is already a specification. Samuel Vazquez, a software engineer at Expedia Group, frames the appeal as an inversion of the usual failure mode with generative tooling: models are poor at inventing shapes and good at filling them in, and a schema hands them a bounded shape for free. The alternative, as his post describes it, is a developer hand-typing a two-hundred-line JSON fixture that the next morning's schema change invalidates.\n\nmockql-rs sits between client and server as a standalone process. Developers annotate fields with @mock and an optional hint, and the tool parses and validates the operation against the schema using apollo-compiler, separates annotated fields from real ones, forwards the real fields upstream, prompts the model with the operation and a subset schema, then merges both into one response. The practical consequence is that a single response can carry live backend data alongside generated data for a field whose resolver does not yet exist. Expedia chose a CLI on the grounds that any test runner, CI job or build script can execute a process, avoiding an SDK or client-library dependency.\n\nThe query annotates only the field that is not ready:\n\n```\nquery TripDetails($id: ID!) {\n trip(id: $id) {\n    property {\n      name\n      address\n    }\n    recommendations @mock(hint: \"5 most popular nearby restaurants\") {\n      title\n      description\n      distance\n    }\n  }\n}\n```\n\nThe response combines both sources, with property resolved upstream and recommendations generated against that context:\n\n```\n{\n  \"data\": {\n    \"trip\": {\n      \"property\": {\n        \"name\": \"Hotel Palazzo Pischedda\",\n        \"address\": \"Via Roma, 09089 Bosa OR, Italy\"\n      },\n      \"recommendations\": [\n        {\n          \"title\": \"Ristorante Sa Pischedda\",\n          \"description\": \"Located directly at the hotel, famous for authentic Sardinian seafood.\",\n          \"distance\": \"0.0 miles\"\n        },\n        {\n          \"title\": \"Locanda di Corte\",\n          \"description\": \"Charming restaurant in the historic medieval center.\",\n          \"distance\": \"0.3 miles\"\n        }\n      ]\n    }\n  }\n}\n```\n\n*(Code samples from the Expedia Group Technology blog post, abridged.)*\n\nThe hotel name and address came from the backend; the restaurant names, descriptions and distances are model output. Both carry equal authority in the same payload, and nothing in the response marks which is which.\n\nAirbnb's approach, published in April, runs at build time instead. Its @generateMock directive is processed during Niobe code generation, emitting both a JSON file of mock data and typed accessor functions for use in demo apps, snapshot tests and unit tests, and the generator deliberately preserves engineers' manual edits on subsequent runs.\n\nThe RFC takes a third position. It defines @mock on operations rather than fields, with a name argument selecting between named responses, and requires that a conforming client return a mock without issuing any network request. Mock responses live in a __graphql_mocks__ directory adjacent to the source file, named for the operation, with a reserved __default__ key and optional descriptions used when regenerating. LLM generation appears only as a recommended strategy, not as the mechanism.\n\nThat difference matters more than the syntax. The RFC requires clients to detect when a mock response has drifted out of validity for its operation and force corrective action, and states that mocks must be validated as part of the application test suite. Expedia's generated data is produced fresh on each run, which delivers contextual coherence but not the repeatability that a snapshot test depends on. Neither post addresses what non-deterministic fixtures mean for CI.\n\nThe RFC also anticipates the agent workflow directly, recommending that implementers ship an Agent Skill so that coding agents can add or modify mock variants conversationally, with a suggested SKILL.md included in the document. That places mock management alongside the other repository conventions agents are being taught to operate.\n\nFor teams weighing adoption, the standards position is the caveat. The RFC remains at Stage 0, described as a strawman, with no champion listed, which is the earliest point in the GraphQL specification process and no guarantee of progression. Expedia's implementation already diverges from it on directive placement, argument name and network behaviour, so a team standardising on @mock today is standardising on one vendor's reading of a name the specification also claims.\n\nThe more durable observation is why this pattern surfaced in GraphQL rather than REST. Schema-shaped output is exactly the constraint that makes generated data usable rather than plausible-looking noise, and it is also what allows a tool to detect when the generated data has stopped matching the query. Whether that becomes a specification or three incompatible implementations is currently an open question.", "url": "https://wpnews.pro/news/llm-generated-graphql-mocks-arrive-at-airbnb-and-expedia-while-the-spec-lags", "canonical_source": "https://www.infoq.com/news/2026/08/graphql-llm-mocking-spec/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global", "published_at": "2026-08-14 10:01:00+00:00", "updated_at": "2026-08-14 10:19:15.452841+00:00", "lang": "en", "topics": ["developer-tools", "generative-ai", "artificial-intelligence"], "entities": ["Expedia Group", "Airbnb", "GraphQL Foundation", "mockql-rs", "Samuel Vazquez", "Niobe"], "alternates": {"html": "https://wpnews.pro/news/llm-generated-graphql-mocks-arrive-at-airbnb-and-expedia-while-the-spec-lags", "markdown": "https://wpnews.pro/news/llm-generated-graphql-mocks-arrive-at-airbnb-and-expedia-while-the-spec-lags.md", "text": "https://wpnews.pro/news/llm-generated-graphql-mocks-arrive-at-airbnb-and-expedia-while-the-spec-lags.txt", "jsonld": "https://wpnews.pro/news/llm-generated-graphql-mocks-arrive-at-airbnb-and-expedia-while-the-spec-lags.jsonld"}}