Introduction to Type System and Language

Learn about the GraphQL type system and language.

We'll cover the following

Type system

We know from the previous lessons that GraphQL selects fields on objects and decides what operation to request. Let’s try breaking down the following GraphQL query:

  pizzas {
  1. We start with a special root object {}.

  2. We select the pizzas field on the object.

  3. We want every returned pizzas object to have id and name.

On GraphQL, the server will always respond to GraphQL queries sent by the client. With this, we can predict what the query will return without knowing too much about the server. But it’s beneficial for us to understand what data is available, what fields we can select, and what operations we can perform.

Every GraphQL server must describe all of the possible data that the client can query. Then when queries come in, they’re validated and executed against that schema.

Type language

GraphQL doesn’t rely on a specific programming language syntax like Python or JavaScript to discuss GraphQL schemas. GraphQL defines its own language. We can use the GraphQL schema language, which is similar to the query language and allows us to talk about GraphQL schemas in a language-agnostic way.

Get hands-on with 1200+ tech skills courses.