This PR implements the GraphQL directives feature.
In particular client-directives are supported, as samarium is a client generation tool.
Client Directives
GraphQL specifies @skip and @include as client directives by default.
In the context of this library, these directives are not really needed, as one can build queries and selections conditionally with code and there's no need for writing queries with string interpolations and conditions - which is what these directives mainly aim to circumvent. It may still be helpful, to have such a directive in your fragment!
Also, this implementation enables the use of any other client directive that may be defined in your schema.
Reduced Output Size
Compared to v0.8.1 the generated output is now 14% smaller (tested with SpaceX's api), despite adding the new features. Unused type definitions were removed while all types remain the same. Many types are now inferred and respect Custom Scalar types.
This PR implements the GraphQL directives feature. In particular client-directives are supported, as samarium is a client generation tool.
Client Directives
GraphQL specifies
@skip
and@include
as client directives by default. In the context of this library, these directives are not really needed, as one can build queries and selections conditionally with code and there's no need for writing queries with string interpolations and conditions - which is what these directives mainly aim to circumvent. It may still be helpful, to have such a directive in your fragment!Also, this implementation enables the use of any other client directive that may be defined in your schema.
Reduced Output Size
Compared to
v0.8.1
the generated output is now 14% smaller (tested with SpaceX's api), despite adding the new features. Unused type definitions were removed while all types remain the same. Many types are now inferred and respect Custom Scalar types.