Documentation
Commands
Introspect

Introspection (Schema)

Dumps an introspection file based on a schema.

Introspection - Usage

Run the following command:

graphql-inspector introspect SCHEMA --write path/to/file

It supports .graphql, .gql and .json extensions.

Arguments

Flags

  • -w, --write <s> - overwrite the output (default: graphql.schema.json)
  • -r, --require <s> - require a module
  • -t, --token <s> - an access token
  • -h, --header <s> - set HTTP header (--header 'Auth: Basic 123')
  • --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)

Output

Writes a file with introspection result.

💡

We recommend to use introspect as part of a git hook. Having an always up-to-date schema file might improve your workflow.

Examples

graphql-inspector introspect example/schemas/new-valid.graphql --write example/schemas

Example file

{
  "__schema": {
    "description": null,
    "queryType": {
      "name": "Query"
    },
    "mutationType": null,
    "subscriptionType": null,
    "types": [],
    "directives": []
  }
}