The following is a glossary of common terms and definitions used in GraphQL.
Fragment
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
{ allThings { ... on Book { title } ... on Car { brand } }
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