The Guild · Example Payload

Schema Stitching Basic Gateway Example

Example of combining two GraphQL subservices using @graphql-tools/stitch with type merging.

API CompositionAPI GatewayAPI ObservabilityBreaking Change DetectionCI/CDCode GenerationDeveloper ToolsExecutionFederationGitHub ActionsGraphQLJavaScriptMicroservicesMiddlewareMockingOpen-SourcePluginsRESTSDKScalarsSchemaSchema CompositionSchema MergingSchema RegistrySchema StitchingSchema TransformationSchema ValidationServerSubscriptionThe GuildType MergingType SafetyTypeScriptgRPC

Schema Stitching Basic Gateway Example is an example object payload from The Guild, with 7 top-level fields. It illustrates the shape of data this provider's APIs accept or return.

Top-level fields

titledescriptionlanguagepackagecodeinputoutput

Example Payload

Raw ↑
{
  "title": "Basic Schema Stitching Gateway",
  "description": "Example of combining two GraphQL subservices using @graphql-tools/stitch with type merging.",
  "language": "TypeScript",
  "package": "@graphql-tools/stitch",
  "code": "import { stitchSchemas } from '@graphql-tools/stitch';\nimport { buildSchema } from 'graphql';\n\nconst usersSchema = buildSchema(`\n  type User {\n    id: ID!\n    name: String!\n    email: String!\n  }\n  type Query {\n    user(id: ID!): User\n    users: [User!]!\n  }\n`);\n\nconst ordersSchema = buildSchema(`\n  type Order {\n    id: ID!\n    userId: ID!\n    total: Float!\n    status: String!\n  }\n  type Query {\n    order(id: ID!): Order\n    ordersByUser(userId: ID!): [Order!]!\n  }\n`);\n\nconst gatewaySchema = stitchSchemas({\n  subschemas: [\n    { schema: usersSchema },\n    { schema: ordersSchema }\n  ],\n  typeDefs: `\n    extend type User {\n      orders: [Order!]!\n    }\n  `,\n  resolvers: {\n    User: {\n      orders: {\n        selectionSet: '{ id }',\n        resolve(user, _args, context, info) {\n          return delegateToSchema({\n            schema: ordersSchema,\n            operation: 'query',\n            fieldName: 'ordersByUser',\n            args: { userId: user.id },\n            context,\n            info,\n          });\n        }\n      }\n    }\n  }\n});",
  "input": {
    "query": "{ user(id: \"1\") { id name email orders { id total status } } }"
  },
  "output": {
    "data": {
      "user": {
        "id": "1",
        "name": "Alice Smith",
        "email": "alice@example.com",
        "orders": [
          { "id": "ord-1", "total": 49.99, "status": "shipped" },
          { "id": "ord-2", "total": 124.50, "status": "pending" }
        ]
      }
    }
  }
}

Work with this as data

Every example here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for examples

4 MCP tools reach this
  • find_examplesBrowse and filter every example in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools

Call it yourself

curl for this page
This example
curl "https://apis.io/api/v1/examples/schema-stitching-basic-gateway-example"
All examples
curl "https://apis.io/api/v1/examples?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.