@gaslight/graphql-import
[![Build Status](https://travis-ci.org/organic-scholar/gaslight.svg?branch=master)](https://travis-ci.org/organic-scholar/gaslight)
Last updated a year ago by organic-scholar .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @gaslight/graphql-import 
SYNC missed versions from official npm registry.

graphql-import

Build Status

Import & export definitions in GraphQL SDL (also refered to as GraphQL modules)

Install

yarn add @gaslight/graphql-import

Usage

import { importSchema } from '@gaslight/graphql-import'
import { makeExecutableSchema } from 'graphql-tools'

const typeDefs = importSchema('schema.graphql')
const resolvers = {}

const schema = makeExecutableSchema({ typeDefs, resolvers })

Assume the following directory structure:

.
├── schema.graphql
├── posts.graphql
└── comments.graphql

schema.graphql

# import Post from "posts.graphql"

type Query {
  posts: [Post]
}

posts.graphql

# import Comment from 'comments.graphql'

type Post {
  comments: [Comment]
  id: ID!
  text: String!
  tags: [String]
}

comments.graphql

type Comment {
  id: ID!
  text: String!
}

https://example.com/graphql

# import User from 'https://exmaple.com/graphql'

Running console.log(importSchema('schema.graphql')) produces the following output:

type Query {
  posts: [Post]
}

type Post {
  comments: [Comment]
  id: ID!
  text: String!
  tags: [String]
}

type Comment {
  id: ID!
  text: String!
}

Related topics & next steps

  • Static import step as build time
  • Namespaces
  • Support importing from HTTP endpoints

Current Tags

  • 0.0.5                                ...           latest (a year ago)

4 Versions

  • 0.0.5                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (13)

Copyright 2014 - 2016 © taobao.org |