Union Type Resolution
Use cases for Union types have been discussed in the schema reference. Here, we discuss how to query union types. Let’s take this modified schema from the Substrate tutorial:schema.graphql
Event will have different fields depending on the underlying type. This query demonstrates how to request different fields for each of these types:
__typename field allows users to discern the returned object type without relying on comparing the sets of regular fields. For example, in the output of the query above JoinGroup and StorageOrder events can only be distinguished by looking at the __typename field. Here is a possible output to illustrate:

