5.7Note on GraphQL Resolvers:

In GraphQL there is only one method of information propagation: the propagation of context through a sequence of resolvers. While this sounds complex, it simply means that when a client reaches the ‘image’ object in Figure 5.6.2 above, it understands the context that I am asking for the image associated with the user that has the id “10”. Every field has a resolver. For scalar fields, the resolver is responsible for returning the actual data that the client sees. For object fields, the resolver instead returns a hidden chunk of data that is forwarded along to the resolvers of the fields contained in the object; these resolvers obtain their parent object’s hidden data, the global context, and any arguments, using all of these values to produce the desired return value set.

Now that we have exhibited a GraphQL query, it is important to note that the response will mirror the structure of that query, as shown below:

{
      “data” : {
                “user” : {
                   “name” : “Satoshi Nakamoto”,
                   “nickname” : “Seb”,
                   “image” : {
                      “url” : “image_url”
                   }
                }
             }
           }

Figure 5.7.1: GraphQL Response

Last updated