This custom graphql-code-generator plugin takes the Linear GraphQL schema and generates GraphQL fragments and operations.
Usage in codegen.doc.yml.
The @linear/sdk uses this code generator plugin to generate:
A fragment for each model in the Linear API containing:
- all scalar fields on the model
- required fields for any nested object with a matching query
- fragment spreads for any nested object with no matching query
An operation for each query and mutation in the Linear API containing:
- all available variables
- fragment spread for the matching model
An operation for each nested query within a model containing:
- all available variables for both the root and child query
- fragment spread for the matching child model
- a query name joining the root and child query fields (eg
query user_assignedIssues)
- The GraphQL schema is parsed using a reusable ContextVisitor to provide consistent information across the Linear code generator plugins
- The context is visited using the FragmentVisitor to return a list of printed GraphQL fragments
- The fragments and context are visited using the OperationVisitor to return a list of printed GraphQL operations
- The printed fragments and operations are returned to be printed
Licensed under the MIT License.