Skip to main content
Back to Dev generators

Dev

Mock GraphQL Schema Generator

Starting a GraphQL API from scratch means writing the same boilerplate every time: a type, two input types, two queries, three mutations, and a root schema block. A mock GraphQL schema generator automates all of that — enter an entity name and field count, and get a complete, spec-compliant SDL file ready for Apollo Server or GraphQL Yoga. The `entity` input determines all derived names. 'Product' produces a Product type, CreateProductInput and UpdateProductInput, product(id: ID!) and products(limit, offset) queries, and createProduct, updateProduct, deleteProduct mutations. The `fieldCount` input picks 2–15 fields from a pool of 15 options including id, name, description, price, quantity, rating, tags ([String]), slug, and imageUrl. The id field is always included; input types strip it and remove non-null markers for update operations.

Read the complete guide — 4 min read

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Type your entity name in singular PascalCase (e.g., "Invoice") into the Entity Name field.
  2. Set the Number of Fields slider to how many properties the type should have, between 3 and 15.
  3. Click Generate to produce the complete SDL schema with types, inputs, queries, and mutations.
  4. Copy the output and paste it into your .graphql file, typeDefs string, or GraphQL Playground schema editor.
  5. Refine field names and types manually, then wire up resolvers to make the schema functional.

Use Cases

  • Spinning up a typeDefs block in Apollo Server before any resolvers are written
  • Generating a plausible SDL fixture for Jest or Vitest unit tests on a GraphQL client
  • Bootstrapping a Postman GraphQL collection with a realistic schema for API demos
  • Creating a Hasura custom action schema without writing SDL from scratch
  • Building SDL examples for workshop exercises covering input types and mutation conventions

Tips

  • Name your entity after a real domain object ("Subscription", "Shipment") to get field names that read as plausible in demos.
  • Generate two related entities separately — e.g., "Order" and "Customer" — then manually add a relationship field to connect them.
  • If you need DateTime fields, generate the schema, then swap any String field that represents a date to a custom scalar DateTime after pasting.
  • Use the output directly in Apollo Sandbox or GraphQL Playground to auto-generate interactive documentation before writing a single resolver.
  • For teaching, generate the same entity with 4 fields and again with 10 to show how input types scale and why field discipline matters.
  • Pair with a mock data generator tool to populate resolver return values that match the generated types, giving you a fully demoable API fast.

FAQ

how do I use a custom entity name and get correct query and mutation names

Type your entity name in singular PascalCase — 'Order', 'BlogPost', 'LineItem' — into the Entity Name field. The generator derives all operation names from it: lowercase camelCase for queries (order, orders), PascalCase with prefix for mutations (createOrder, updateOrder, deleteOrder), and PascalCase with suffix for inputs (CreateOrderInput, UpdateOrderInput). Correct casing produces conventional SDL that follows GraphQL community naming standards.

is the generated schema valid sdl I can run with apollo server

Yes. The output follows standard GraphQL Schema Definition Language and is compatible with Apollo Server, GraphQL Yoga, and Mercurius — drop it into a typeDefs string or a .graphql file without modification. For production, review non-null constraints on input fields and add custom scalars like DateTime where needed, but the structure is spec-compliant from the start.

what queries and mutations does the generator always include

You always get two queries: a single-item lookup (entity(id: ID!): Entity) and a paginated list (entities(limit: Int, offset: Int): [Entity!]!). You always get three mutations: create (accepts CreateEntityInput, returns Entity!), update (accepts ID plus UpdateEntityInput, returns Entity!), and delete (accepts ID, returns Boolean!). All five operations are wired into the root Query and Mutation types automatically.

which fields does the generator pick and can I control them

The generator selects randomly from a pool of 15 realistic field options including id, name, description, createdAt, updatedAt, isActive, price, quantity, rating, tags ([String]), slug, imageUrl, ownerId, category, and externalRef. The fieldCount input controls how many are selected, and id is always included. You cannot specify which individual fields appear — the selection is random each run, so you can regenerate until the combination suits your needs.

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.