Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.34 KB

README.md

File metadata and controls

58 lines (40 loc) · 1.34 KB

graphql-introspect

CLI tool for building GraphQL schemas representation in the Schema Language format from GraphQLSchema object or GraphQL server URL.

wercker status

Installation

npm install -g graphql-introspect

Usage

Using remote GraphQL server URL

$ graphql-introspect http://example.com/graphql

Using local schema module

$ graphql-introspect /path/to/schema.js

(See an example of local schema module in test/schema.js)

Output

graphql-introspect writes its output to STDOUT. To save a schema to a file use output redirection:

$ graphql-introspect /path/to/schema.js > /path/to/schema.graphql

API

const {
  introspect,
  introspectURL,
  introspectFile
} = require('graphql-introspect')

introspect('http://example.com/graphql').then(out => {...}).catch(err => {...})
// Same as 
introspectURL('http://example.com/graphql').then(out => {...}).catch(err => {...})

introspect('/path/to/schema.js').then(out => {...}).catch(err => {...})
// Same as 
introspectFile('/path/to/schema.js').then(out => {...}).catch(err => {...})