Dev
Dummy GraphQL Variables Generator
Every GraphQL mutation and query test needs a variables JSON object, and writing them by hand is tedious: UUIDs need to be valid, nested input objects need the right field names, and enum values need to match the schema. This generator produces realistic variable JSON for five common operations — createUser, updateUser, deleteItem, getProduct, and createOrder — with properly formatted values throughout. The Operation Type selector determines the entire shape of the output. createUser produces an input object with first name, last name, email, age, and role enum (USER, ADMIN, MODERATOR). updateUser generates a UUID id plus an input with status, age, and role for a partial update pattern. deleteItem outputs a UUID id and a hardDelete boolean. getProduct includes a UUID id, a locale string (en-US, de-DE, fr-FR, en-GB), and an includeVariants boolean. createOrder produces a customerId UUID plus an items array of one to four line items, each with a productId UUID, quantity, and price, plus a currency and status. The How Many field generates a batch in one pass — useful for test.each() fixtures or a Jest beforeAll block. All UUID fields follow the v4 format with correct version and variant bits, so strict UUID validators pass without issue.
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Select an operation type from the dropdown — createUser, updateUser, deleteItem, getProduct, or createOrder.
- Set the count field to how many distinct variable objects you need in a single batch.
- Click Generate to produce the JSON output in the results panel below.
- Copy one object or the full array, then paste it into the Variables panel of your API client or save it as a test fixture file.
Use Cases
- •Pasting createUser variable JSON into GraphQL Playground to test resolver input validation
- •Saving a batch of 10 createOrder objects as Jest fixtures and iterating with test.each()
- •Populating Postman collection variables for a GraphQL CI pipeline smoke test
- •Supplying realistic updateUser payloads to MSW GraphQL handlers in a React component test
- •Generating deleteItem and getProduct variables to verify ID-format checks in Apollo Server middleware
Tips
- →Generate 5-10 createUser objects at once, then use them as seeds in a beforeAll() block to populate a test database before running query tests.
- →For deleteItem and updateUser operations, copy an ID from a createUser result first so your test chain uses consistent, referentially valid identifiers.
- →Combine multiple operation types in one test file: generate createOrder variables to insert records, then use getProduct variables to verify reads — covering a full CRUD cycle.
- →When documenting an API, generate one object per operation and include them in your README or Notion doc as 'example variables' so consumers can copy-paste immediately.
- →If your resolver enforces strict UUID validation, the generated UUIDs will pass it — but swap in a malformed ID manually in one test case to confirm your error handling fires correctly.
- →Use the batch output with MSW's graphql.mutation handler: map the array into separate handler responses to simulate different server states in Storybook or component tests.
FAQ
how do I use generated GraphQL variables in Postman
Set the request body to raw JSON with two keys: 'query' holding your operation string and 'variables' holding the JSON from this generator. Alternatively, switch Postman to its native GraphQL body mode, which gives you a dedicated Variables field where you can paste the output directly.
why use realistic variable data instead of simple placeholders like id: 1
Realistic UUIDs and properly formatted fields trigger validation layers — ID format checks, email regex, nested input type guards — that simple placeholder values silently skip. Bugs caught at that layer in testing are bugs that will not reach production. A malformed UUID or missing required field that slips through in tests can cause obscure runtime failures.
which operations does this generator support
Five operations are available: createUser (input with name, email, age, role), updateUser (id + partial input with status, age, role), deleteItem (id + hardDelete boolean), getProduct (id + locale + includeVariants boolean), and createOrder (customerId + items array + currency + status). Custom operations are not supported — pick the closest match and edit the output.
can I use the generated variables with Apollo Client devtools
Yes. Open Apollo Client devtools in your browser, navigate to the Operations panel, and paste the generated JSON into the variables input before running the mutation or query. It is a fast way to test against your live frontend Apollo instance without building a temporary form.
You might also like
Popular tools from other categories that share themes with this one.
Try these next
More free tools from other corners of the catalog, picked by shared themes.