Abstract Type Union

Learn how to use union and introspecting value types in GraphQL.

Using unions

A GraphQL union type is an abstract type that represents a set of specific concrete types. For instance, in our PlateSlate search example, a :search_result could be a union type for both :menu_item and :category. Let’s define that in our schema. However, first, we need to add the :category type. It’s a straightforward grouping of :menu_item records with a name and description:

Get hands-on with 1400+ tech skills courses.