Getting Started and Installation
You can choose one to more of the following ways to use GraphQL Inspector.
GitHub Action
- Visit GraphQL Inspector on GitHub Marketplace.
- 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:
Command | Description | More |
---|---|---|
—version | Show version number | [boolean] |
-r, —require | Require modules | [array] |
-t, —token | Access Token | [string] |
-h, —header | Http Header | [array] |
—hl, —left-header | Http Header - Left | [array] |
—hr, —right-header | Http Header - Right | [array] |
—help | Show 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