A tool to merge and stitch modularized GraphQL files into one schema file
- Built in Go
 - No 3rd party dependency
 
- Fast, blasing fast
 - Find 
*.graphqland*.gqlfiles in recursive way - Merge and stitch schema from several directories
 - CLI to use in shell or script
 
Homebrew
$ brew install mununki/tools/gqlmergeUsing go get
$ go get -u github.com/mununki/gqlmergeBuilding with source code
$ git clone https://github.com/mununki/gqlmerge
$ cd gqlmerge
$ go installImport gqlmerge module
import gql "github.com/mununki/gqlmerge/lib"
func main(){
	// ...
	// "  " is indent for the padding in generating schema
	// in case of using as go module, just " " would be fine
	//
	// paths should be a relative path
	schema := gql.Merge(" ", path1, path2, ...)
}If you have a modularized GraphQL schema files, such as *.graphql, there might be a duplicated types among them. In this case, gqlmerge will help you to merge and stitch it into one schema.
Before
# GetMyProfile.graphql
type Query {
  getMyProfile: UserResponse!
}
type UserResponse {
  ok: Boolean!
  error: String
  user: User
}
type User {
  id: ID!
  email: String!
  fullName: String!
  # ...
}
# CheckIfExists.graphql
type Query {
  checkIfExists(userId: ID!): CheckIfExistsResponse!
}
type CheckIfExistsResponse {
  ok: Boolean!
  error: String
  user: [User]!
}
type User {
  id: ID!
  email: String!
  fullName: String!
  # ...
}Merge & Stitch
$ gqlmerge ./schema schema.graphqlAfter
type Query {
  getMyProfile: UserResponse!
  checkIfExists(userId: ID!): CheckIfExistsResponse!
}
type UserResponse {
  ok: Boolean!
  error: String
  user: User
}
type CheckIfExistsResponse {
  ok: Boolean!
  error: String
  user: [User]!
}
type User {
  id: ID!
  email: String!
  fullName: String!
  # ...
}$ gqlmerge --indent=2s [PATH ...] [OUTPUT]
// PATH : directories with schema
// OUTPUT : output file name- additional error handling
 
