Documentation
Getting Started and Installation

Getting Started and Installation

You can choose one to more of the following ways to use GraphQL Inspector.

GitHub Action

  1. Visit GraphQL Inspector on GitHub Marketplace.
  2. Follow the installation instructions provided in the “GitHub Action” chapter.

CLI

The Command Line Tool provides all the features of GraphQL Inspector and can be installed with a single command:

Install using:

npm i --global @graphql-inspector/cli graphql

We added graphql package as a peer dependency to make sure you have the right version installed.

CLI Usage

graphql-inspector --help

Options:

CommandDescriptionMore
—versionShow version number[boolean]
-r, —requireRequire modules[array]
-t, —tokenAccess Token[string]
-h, —headerHttp Header[array]
—hl, —left-headerHttp Header - Left[array]
—hr, —right-headerHttp Header - Right[array]
—helpShow help[boolean]

CLI for CI

Works similar to regular CLI but every feature is pluggable to keep the size as low as possible.

Install using:

npm i --global @graphql-inspector/ci

Commands

Every command is installable through a package.

  • diff - @graphql-inspector/diff-command
  • validate - @graphql-inspector/validate-command
  • coverage - @graphql-inspector/coverage-command
  • similar - @graphql-inspector/similar-command
  • introspect - @graphql-inspector/introspect-command
  • serve - @graphql-inspector/serve-command

Please take a look at “Continuous Integration” chapter.

CLI for CI - Usage

graphql-inspector --help

Programmatic API

GraphQL Inspector comes with a programmatic API, here is how to use the Core package.

Install using your favorite package manager:

npm i @graphql-inspector/core

Programmatic API - Usage

import { diff, validate, coverage, ... } from '@graphql-inspector/core'

Docker

GraphQL Inspector is also available on Docker.

docker run kamilkisiela/graphql-inspector --help

Bind volumes to /app for working with local files, for example:

docker run -v $PWD:/app kamilkisiela/graphql-inspector graphql-inspector diff old.graphql new.graphql

To run commands interactively inside of the container, use the following:

docker run -it kamilkisiela/graphql-inspector