Four artefacts come out of the same field list: the SDL type, a query that selects it, a mutation that creates it, and a response payload shaped to match. They stay consistent with each other, which hand-written mocks rarely do.
What you can control
- SDL output includes the input type and the query and mutation fields, not just the object type.
- Relay mode adds the full connection shape — edges, nodes, cursors and
pageInfo. - Query and mutation documents come with a matching variables block.
- Nullability follows the field:
idis non-null, an optional string is not.
What this is not
Cursors are base64-encoded index strings rather than opaque server tokens. They are the right shape for testing a client, not for a server implementation.
Questions
Is the SDL valid GraphQL?
Yes. It parses under the GraphQL specification, including the input type and the root query and mutation fields.
What is a Relay connection?
A pagination convention: a list of edges, each wrapping a node and a cursor, plus a pageInfo object. Relay clients expect it, and many non-Relay servers adopt it anyway.
Can I use the response payload with a mock server?
Yes. It is a standard { data: { ... } } envelope that MSW, Mirage or any static mock will serve directly.