The Guild LogoThe Guild Monogram

Search docs

Search icon

Products by The Guild

Products

Hive logoHive blurred logo

Hive

Schema Registry for your GraphQL Workflows

Skip to main content

Validate documents

Validates documents against a schema and looks for deprecated usage.

Validate

Usage#

Run the following command:

graphql-inspector validate DOCUMENTS SCHEMA

Example

graphql-inspector validate './documents/*.graphql' http://localhost:3000/graphql

Arguments

  • DOCUMENTS - a glob pattern that points to GraphQL Documents / Operations
  • SCHEMA - point to a schema

Flags

  • -d, --deprecated - Fail on deprecated usage (default: false)
  • --noStrictFragments - Do not fail on duplicated fragment names (default: false)
  • --apollo - Support Apollo directives (@client and @connection) (default: false)
  • --keepClientFields <b> - Keeps the fields with @client, but removes @client directive from them - works only with combination of --apollo (default: false)
  • --method - method on url schema pointers (default: POST)
  • --federation - Support Apollo Federation directives (default: false)
  • --aws - Support AWS Appsync directives and scalar types (default: false)
  • --maxDepth <n> - Fail when operation depth exceeds maximum depth (default: false)
  • --filter <s> - show warnings and errors only for a file (or a list of files)
  • --silent - silent mode
  • --output <s> - writes errors to a file
  • --onlyErrors - shows only errors
  • --relativePaths - displays file paths relative to process cwd
  • -r, --require <s> - require a module
  • -t, --token <s> - an access token
  • -h, --header <s> - set http header (`--header 'Auth: Basic 123')

Output

A list of errors found in documents. A second list with every deprecated usage.

When there's at least one error or a deprecated usage (when --deprecated flag is enabled), process fails.