Writing the GQL schema
We must write the GQL schema by using its type system. If we think first about our data, it will be easier to implement it. Let’s try to convert the following diagram to a schema:
Figure 14.2 – Data relation
The data relation in Figure 14.2 describes the entities and the relations between them:
- A family has multiple members
- A person may have numerous friends that are other family members
So, we can represent these entities into object types by writing the following Schema Definition Language (SDL):
type Family {   id: ID!   name: String!   members: [Person!]! } type Person {   id: ID!   family: Family!   fullName: String!   nickName: String   friends: [Person!]! }
The syntax to define a GQL entity is easily readable. We have defined two types. Each type has a PascalCase
name and a list of fields surrounded by curly...