Skip to content

digiz3d/graphql-toolkit

Repository files navigation

GraphQL toolkit - gqlt

Extremely fast GraphQL parser and merger.

It can stitch and merge schema files together.

Demo

Merging schema files:

Demo showing usage of gqlt

Usage

gqlt merge ./file1.graphql ./file2.graphql ./combined.graphql
or even, when your shell (e.g. zsh) supports it:
gqlt merge ./graphql/**/*.graphql ./combined.graphql

The last path is the output file.

note: bash is also supported for recursive globs (path/**/*.gql) with shopt -s globstar

Options

--sort: sort the definitions and fields by name in the merged document.

Install

brew install digiz3d/tap/gqlt

Stack

Made 100% with Zig.
No dependencies.

Compile from source

Run zig build.
gqlt will be compiled for your current platform here: ./zig-out/bin/gqlt.

Comparison with other tools

Tools we compare gqlt with:
@graphql-tools/merge
gqlmerge

gqlt @graphql-tools/merge gqlmerge
Speed fastest 🚀 slow fast
Limitations
  • no directives concatenation
none
  • no object/input/union/interface/enum merging
  • no directives concatenation
Indentation ❌ inconsistent
Sort definitions
Descriptions
Comments
Double quotes in block strings

see benchmarks

Motivations

By doing this project, my goals were to

  1. learn Zig
  2. write my first, real parser
  3. implement some benchmark

Thanks to

  • gqlmerge. Even if it did not work for my use case, it is a great tool for simpler projects. Learnt a lot from it !
  • astexplorer for visual representation of the JS GraphQL parser output.
  • GraphQL specification for the grammar and the syntax.

About

GraphQL CLI toolkit that can merge/stitch schema files

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages