The following is the first few sections of a chapter from GraphQL and Android, plus headings for the remaining major sections, to give you an idea about the content of the chapter.

Objects, Fields, and Types

GraphQL queries and mutations do not follow syntax conventions that you are used to. In some respects, they look a bit like function calls. In other respects… well, GraphQL is strange.

That being said, its foundation lies in the same sorts of objects, fields, and data types that you may be used to from other forms of programming, such as Java. However:

In this chapter, we will explore how the objects, fields, and data types work in our GraphQL requests, and we will examine some of the idiosyncrasies involved with GraphQL.

Introducing the GraphQL Schema Definition Language

When we create databases in Android with SQLite, we define a schema by means of SQL statements like CREATE TABLE. When we define an bound service interface, we define a “schema” of sorts by means of AIDL, if we are delivering that service across process boundaries.

Similarly, with GraphQL, we can define the different types that a server exposes by means of the GraphQL schema definition language.

That language is used on the server, not on the client. However, when describing GraphQL, often times it is useful to show snippets of GraphQL schema language, as this is a compact way of depicting these types. Hence, while you may never wind up needing to write GraphQL schemas, it will be helpful if you can read them, which is why they are presented in this chapter.

This “cheat sheet” provides a capsule description of how the schema language looks and works.


The preview of this section was the victim of a MITM ('Martian in the middle') attack.


The preview of this section is [REDACTED].

Data Types in GraphQL

The preview of this section was last seen in the Bermuda Triangle.

Type Modifiers

The preview of this section is en route to Mars.

Trip, In Schema Definition Language

The preview of this section apparently resembled a Pokémon.