Understanding how transformers work
Transformers work by keeping your database model definition inside a GraphQL file. Of course, this is not our main schema file where we implement resolvers. It is a source of truth for the system that transforms the model into a generated backend, which is responsible for exposing the output schema. This usually happens by generating code for GraphQL nodes and fields that implement directives specified by the transformer technology.
Figure 6.1: Transformer process flow
The @model
directive is a powerful feature provided by GraphQL transformers that simplifies the process of building scalable and flexible data models for your applications. With the @model
directive, you can easily define your data schema using GraphQL syntax, and the transformer will take care of generating the necessary code and infrastructure to manage your data.
When you apply the @model
directive to a GraphQL type, GraphQL transformers automatically...