Yoctol/fetch-graphql-schema

Name: fetch-graphql-schema

Owner: YOCTOL INFO INC.

Description: fetch GraphQL schema via introspection query

Created: 2016-11-11 14:03:55.0

Updated: 2017-12-01 16:15:55.0

Pushed: 2016-11-22 10:49:40.0

Homepage: null

Size: 12

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

fetch-graphql-schema

NPM version Build Status Test coverage Dependency Status

fetch GraphQL schema via introspection query

Install
m install fetch-graphql-schema
Usage
t fetchSchema = require('fetch-graphql-schema');

hSchema('http://localhost:8080/graphql')
hen(schemaJSON => {
/**
 * {
 *   "data": {
 *     "__schema": {
 *       "queryType": {
 *         "name": "Query"
 *          ....
 */
;

hSchema('http://localhost:8080/graphql', { readable: true })
hen(clientSchema => {
/**
 * type User implements Node {
 *   id: ID!
 *   name: String!
 * }
 */
;

API
fetchGraphqlSchema(url, [options])
url

Required Type: string

URL of GraphQL server.

options readable

Type: boolean Default: false

resolve .graphql instead of .json.

CLI
Usage
tch-graphql-schema <schemaUrl>
Options
--output    Specify an output filename.
--readable  Resolve .graphql instead of .json.
Examples
tch-graphql-schema http://api.server/graphql -o schema.json
tch-graphql-schema http://api.server/graphql -o schema.graphql -r
License

MIT © C.T. Lin


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.