The Guild LogoThe Guild Monogram

Search docs

Search icon

GraphQL Inspector

Bulletproof your GraphQL

Get Started

Providing Schema#

There are few options to provide your schema in GraphQL Inspector.

JavaScript / TypeScript file#

GraphQL Inspector accepts CommonJS and ESModules


// Example for loading and merging multiple .graphql files into a single schema const { makeExecutableSchema } = require("@graphql-tools/schema"); const { loadFilesSync } = require('@graphql-tools/load-files'); const typeDefs = loadFilesSync('**/*.graphql'); module.exports = makeExecutableSchema({ typeDefs })

ESM default export

import { makeExecutableSchema } from "@graphql-tools/schema"; import { typeDefs } from "./type-defs"; // as `default` export default makeExecutableSchema({ typeDefs })

ESM named export

import { makeExecutableSchema } from "@graphql-tools/schema"; import { typeDefs } from "./type-defs"; // as `schema` variables export const schema = makeExecutableSchema({ typeDefs })

If you need to transpile a file, use --require option of the CLI:

$ graphql-inspector introspect ./schema.ts --require ts-node/register

GraphQL file#

Files with those extensions: .graphql, .graphqls or .gql are supported by GraphQL Inspector.

$ graphql-inspector diff ./old-schema.graphql ./new-schema.gql

JSON file#

A JSON file with introspection result can also be provided

$ graphql-inspector diff ./old-schema.json ./new-schema.json

GraphQL endpoint#

GraphQL Inspector can also introspect your GraphQL server:

$ graphql-inspector diff ./new-schema.json

Git repository#

Get GraphQL Schema file from any branch or commit of your git repository:


For example, you want to get schema.graphql from origin/master:


GitHub repository#

Yes, GraphQL Inspector can also do that, here's the pattern:


  • github - stays there, it tells Inspector we want to use github
  • owner - your github username or organization
  • name - repository's name
  • ref - can be name of a branch or commit sha
  • path/to/file - where Inspector can find the graphql file

For example, we want to fetch a .graphql file from master branch of this sample repository:

github:kamilkisiela/graphql-inspector-example#master:./schema.graphql --token 'github-token-here'

GitHub Loader requires a GitHub token to be defined

Programmatic API#

If you are using programmatic API, you might find @graphql-tools/load package useful for loading schemas. Learn more here.