The GraphQL schema is at the heart of any GraphQL project. This video describes how a schema is constructed to allow for the querying and mutation of data.
- [Announcer] So far, we've made a few queries to grab values from specific fields of data. But we haven't talked much about how this is working behind the scenes. The way that these fields are set up is determined by GraphQL schema. The schema provides all of the different object types that are used in our data. It also specifies the types for all of these values. What's nice about using the graphical interface is that the schema is very well documented right here in the browser.
If I click on this docs option here, it'll expand a tab, and this opens up the documentation explorer. Once we provide a schema, the documentation will automatically generate. So, here we have two different types. We have queries for getting data, and we have mutations for changing data, which we'll discuss in a later chapter. If we navigate to the query here, though, you'll see several of these queries that we've already executed. We have viewer, we have repository, repository owner, and so on.
If I click on the repository, we're going to see that all of these different arguments are in place, and it's corresponding to this type called repository. So in the next video, we're going to take a closer look at these types and how they're set up.
In this course, learn how to get started with GraphQL. Eve Porcello walks through the basics of this query language, diving into the data fetching specification, and helping you get up to speed with the syntax and vocabulary of GraphQL. Eve explains how to create basic queries, including how to work with arguments and multiple fields. She also goes into complex techniques for handling data, including working with aliases, fragments, and pagination. Plus, she covers how to edit and transform data with mutations.
- Learning about the origins of GraphQL
- Learning about how GraphQL makes data fetching and updating easier
- Creating basic queries
- Using multiple fields
- Understanding schemas
- Handling data
- Drilling down into nested fields with a query
- Adding variables for argument values
- Creating mutations
- Adding a reaction mutation