graphql-import
Install
yarn add graphql-import
Usage
; // or .gql or glob pattern like **/*.graphql; ;
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!}
Running 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!}