Skip to content
faker.tools
All 79

Plate IV · Developer, API & Database Seeding Utilities

GraphQL Mock Generator

SDL schemas, query documents, mutations and response payloads.

graphql
{
  "data": {
    "users": [
      {
        "id": 1,
        "fullName": "Alice Young",
        "email": "alice.young@example.com",
        "city": "Boise",
        "isActive": true,
        "createdAt": "2025-11-01T21:05:30Z"
      },
      {
        "id": 2,
        "fullName": "Ryan Lopez",
        "email": "ryan.lopez@example.com",
        "city": "Brooklyn",
        "isActive": true,
        "createdAt": "2026-01-09T21:05:30Z"
      },
      {
        "id": 3,
        "fullName": "Linda Anderson",
        "email": "linda.anderson@example.com",
        "city": "Savannah",
        "isActive": false,
        "createdAt": "2026-01-21T21:05:30Z"
      }
    ]
  }
}
30 lines · 674 BGenerated in your browser · GraphQL Mock Generator

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: id is 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.

Next in Developer

All 11