Docblock Tags
In order for Grats to extract a GraphQL schema from your code, simply mark which TypeScript structures should be included in the schema with special JSDoc tags such as /** @gqlType */ or /** @gqlField */.
caution
JSDocs must begin with /** (two asterisks). However, they may be consolidated into a single line /** Like this */.
info
- To learn about comment syntax, see Comment Syntax
- To learn why Grats uses comments, see Why Use Comments
Each tag maps directly to a concept in the GraphQL Schema Definition Language (SDL). The following JSDoc tags are supported:
@gqlType@gqlField- Root fields (
@gqlQueryField,@gqlMutationField,@gqlSubscriptionField) - Arguments
- Context (
@gqlContext) - Info
- Root fields (
@gqlInterface@gqlUnion@gqlEnum@gqlScalar@gqlInput@gqlDirective@gqlAnnotate
tip
This documentation aims to be complete, but our hope is that you feel empowered to just slap one of these docblock tags on the relevant TypeScript class/type/method/etc in your code, and let Grats' helpful error messages guide you.