Schema, validation, and resolvers

On the server side, a GraphQL schema is used by the GraphQL runtime to figure out what is being requested and how to retrieve it.

We won't be able to cover schemas in detail but know that they are central to GraphQL. They describe the different objects, their types (we won't be able to cover String, Int, Float, Boolean, ID, and so on), as well as all supported queries and mutations, with their required/optional arguments.

Whenever a request comes in, it is validated against the schema (which can, for example, force some fields to be present). If the validation passes, then the query is analyzed and GraphQL resolvers take care of getting the requested data.

As a matter of fact, responses can (optionally) also be validated against the schema. 

As we will see with our application, the schema can also be used to generate classes/types/interfaces that correspond to it. We'll also see that it is a mature ecosystem of tools to assist us with that process.

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.87.156