Skip to main content
Dev · 283 tools

Mock GraphQL Schema Generator

Generates realistic mock GraphQL schemas with types, queries, and mutations

GraphQL SchemaExample — click Generate for yours
type Product { id: ID! defaultView: String syncStatus: String attributesJson: String featuredAt: String emoji: String } input CreateProductInput { defaultView: String syncStatus: String attributesJson: String featuredAt: String emoji: String } input UpdateProductInput { id: ID! defaultView: String syncStatus: String attributesJson: String featuredAt: String emoji: String } type Query { product(id: ID!): Product products(limit: Int, offset: Int): [Product!]! } type Mutation { createProduct(input: CreateProductInput!): Product! updateProduct(input: UpdateProductInput!): Product! deleteProduct(id: ID!): Boolean! } schema { query: Query mutation: Mutation }

Generated 78 words · 714 characters

See 3 examples
  • Example 1
    type Product {
      id: ID!
      defaultView: String
      syncStatus: String
      attributesJson: String
      featuredAt: String
      emoji: String
    }
    
    input CreateProductInput {
      defaultView: String
      syncStatus: String
      attributesJson: String
      featuredAt: String
      emoji: String
    }
    
    input UpdateProductInput {
      id: ID!
      defaultView: String
      syncStatus: String
      attributesJson: String
      featuredAt: String
      emoji: String
    }
    
    type Query {
      product(id: ID!): Product
      products(limit: Int, offset: Int): [Product!]!
    }
    
    type Mutation {
      createProduct(input: CreateProductInput!): Product!
      updateProduct(input: UpdateProductInput!): Product!
      deleteProduct(id: ID!): Boolean!
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
  • Example 2
    type Product {
      id: ID!
      isRefundable: Boolean!
      isVegan: Boolean!
      isDraft: Boolean!
      qrCodeUrl: String
      manualUrl: String
    }
    
    input CreateProductInput {
      isRefundable: Boolean
      isVegan: Boolean
      isDraft: Boolean
      qrCodeUrl: String
      manualUrl: String
    }
    
    input UpdateProductInput {
      id: ID!
      isRefundable: Boolean
      isVegan: Boolean
      isDraft: Boolean
      qrCodeUrl: String
      manualUrl: String
    }
    
    type Query {
      product(id: ID!): Product
      products(limit: Int, offset: Int): [Product!]!
    }
    
    type Mutation {
      createProduct(input: CreateProductInput!): Product!
      updateProduct(input: UpdateProductInput!): Product!
      deleteProduct(id: ID!): Boolean!
    }
    
    schema {
      query: Query
      mutation: Mutation
    }
  • Example 3
    type Product {
      id: ID!
      customerId: ID
      maxRetries: Int
      hasInsurance: Boolean!
      latitude: Float
      billingAddressId: ID
    }
    
    input CreateProductInput {
      customerId: ID
      maxRetries: Int
      hasInsurance: Boolean
      latitude: Float
      billingAddressId: ID
    }
    
    input UpdateProductInput {
      id: ID!
      customerId: ID
      maxRetries: Int
      hasInsurance: Boolean
      latitude: Float
      billingAddressId: ID
    }
    
    type Query {
      product(id: ID!): Product
      products(limit: Int, offset: Int): [Product!]!
    }
    
    type Mutation {
      createProduct(input: CreateProductInput!): Product!
      updateProduct(input: UpdateProductInput!): Product!
      deleteProduct(id: ID!): Boolean!
    }
    
    schema {
      query: Query
      mutation: Mutation
    }

About this 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 sets 2–15 fields, drawn from a pool of about 800 realistic fields — names and titles, timestamps like publishedAt, foreign keys like ownerId, flags like isFeatured, counts like viewCount, URLs, prices and measurements, addresses, statuses, and list fields like tags ([String]) and categoryIds ([ID!]). The id field is always included; input types strip it and remove non-null markers for update operations.

How to use

  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 2 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 draws from a pool of about 800 realistic field names, each with a sensible type: strings such as name, sku, and postalCode; timestamps such as createdAt and shippedAt; ID references such as ownerId and warehouseId; Boolean flags such as isActive and hasVariants; Int counts and sizes such as viewCount and stockLevel; Float prices, rates, and measurements such as price, taxRate, and weightKg; URLs such as imageUrl; and list fields such as tags and categoryIds. fieldCount controls how many appear, and id is always included. The selection is random each run, so regenerate until the combination suits your needs.

You might also like

Popular tools from other categories that share themes with this one.