Changing Data with GraphQL

In this chapter, we finish the shop’s GraphQL API, and then we look at how the application behind the API is organized.

After reading this chapter, you should be able to:

  • Read a mutation and say what it changes and what it returns
  • Explain why the idempotency key is an argument of the mutation and not a header
  • Explain why a GraphQL response can carry data and errors together, and why the HTTP status code carries less information
  • Read a query that uses variables and say where its values come from
  • Read a paginated list field and its page type
  • Name what GraphQL gives up compared with REST
  • Say which schema changes are safe and which break a client
  • Choose between REST and GraphQL for a given API
  • Assign the shop’s work to the API, business logic, and data access layers, and say which layer a given change touches
  • State the benefits and costs of a layered architecture
  • Distinguish a layer from a deployment boundary and from a tier

Sections

  1. Mutations
  2. Errors and Status Codes
  3. Variables
  4. Paginating a List
  5. What GraphQL Gives Up
  6. Changing the Schema
  7. Choosing REST or GraphQL
  8. Layered Architecture
  9. Layers and Deployment Boundaries