Comparison with other clients
This page compares typed-graphql-builder
with Zeus and tql, as those were the two libraries that served as the primary inspiration.
typed-grapql-builder
owes much of its API design to tql. Although our
initial design sketches predate it, tql
is still the principal inspiration for
typed-graphql-builder
's API, especially variables, aliases and selections, with only a few
differences:
- scalar fields can be selected without method calls i.e.
[t.id, t.name]
instead of[t.id(), t.name()]
- the union selection method is called
$on
instead ofon
to more easily avoid conflict with existing field names - fragments are supported via the
fragment
function
In terms of capabilities, there are two notable differences:
typed-graphql-builder
can infer a variable placed anywhere in an input type.typed-graphql-builder
supports custom mapping for scalars
The generated code is where most of the differences come from. Here, we took inspiration from the
way graphql-zeus
provides a compact map of all input types. In this way, we reduce the generated
code size to ~ 25% of what tql
generates.
The estimate is based on the Hasura generated schema of a large database included in the examples
(x.graphql
). Below is the size of the generated client for a very large Hasura schema:
schema | tql | typed-graphql-builder |
---|---|---|
x.graphql | 3.43 MB | 0.71 MB |
note: generated with
tql
v1.0.0-rc.10 andtyped-graphql-builder
v1.3.1