GraphQL Terminology

The following is a glossary of common terms and definitions used in GraphQL.


A group of fields specified together (on the client) which can be used in many places in one query or in several queries. For example: name, ID and address could be grouped together in a fragment called EmployeeInfo, and this fragment can be used to request this group of fields in several places in a query.

Inline Fragment

Inline Fragments are elements of queries used to request fields of a Union Type or an Interface Type. Suppose we have a type Thing which is a union of Book and Car – if we want to query a list of Things, we might want to get titles for books and brands for cars, which are fields that only make sense for these individual types respectively. So with inline fragments we can write something like this:
   allThings {
      ... on Book {
      ... on Car {

Root Type

Root types are GraphQL types which allow us to reach all the other types: they are the starting points for queries and appear as the entry points to explore from in the GraphiQL explorer. There are three root types: Query, Mutation, Subscription. For example, we can reach all of the specific query types possible from the root type called Query.

Union Type

A union type or simply union in GraphQL is a type made up of several other types. For example, we can define a type Pet to be a union of Cat and Dog. This would mean that Pet type objects can be either Cat or Dog objects, with potentially different fields. The syntax is:

union Pet = Cat | Dog