Skip to main content
Version: s5

Union Types


Union types are used when a Query or Field can return a union of different data types. In the Sanctuary Health API this notably is used from Post to the relevant media, represented as a MediaUnion and from Course to the relevant standalone content, represented as a CourseItemContentUnion.

Access union data

The syntax for accessing union type data is the same as to the syntax for fragments, just apply a fragment for the attributes you want for each union type.

Inline fragments

For the case of union types you can also specify these fragments inline by skipping the fragment keyword and the fragment name.