Creating self-documenting schemas
As you can see from our library schema, even though it doesn’t have documentation, just by looking at it, we know exactly what the system based on this schema is used for. This is clear to every member of the team.
Now, let’s go further, looking at self-documenting schemas – these are GraphQL schemas that contain comprehensive and descriptive naming and connections between nodes, allowing developers to easily understand and interact with the available data and operations. Here, we will look at the different elements that make up these schemas.
Custom scalars
Scalars represent simple primitives in GraphQL. There are five built-in scalars in GraphQL: String
, Int
, Float
, ID
, and Boolean
. Out of these five scalars, only ID
needs to be translated, as it is used to indicate a unique key and can be either a string, a number, or a custom object.
With custom scalars, the situation is different as they behave according to how...