@@ -1305,16 +1305,17 @@ UnionMemberTypes :
13051305- = `|`? NamedType
13061306
13071307GraphQL Unions represent an object that could be one of a list of GraphQL Object
1308- types , but provides for no guaranteed fields between those types . They also
1309- differ from interfaces in that Object types declare what interfaces they
1310- implement , but are not aware of what unions contain them .
1308+ types . They differ from interfaces in that Object types declare what interfaces
1309+ they implement , but are not aware of what unions contain them .
13111310
13121311With interfaces and objects , only those fields defined on the type can be
13131312queried directly ; to query other fields on an interface , typed fragments must be
1314- used . This is the same as for unions , but unions do not define any fields , so
1315- **no ** fields may be queried on this type without the use of type refining
1316- fragments or inline fragments (with the exception of the meta-field
1317- {\_\_typename}).
1313+ used . This is the same as for unions , but unions do not directly define any
1314+ fields , so the only fields that may be queried on a Union are the meta -field
1315+ {\_ \_typename } and the fields of the interfaces that the Union declares it
1316+ implements (see
1317+ [Unions Implementing Interfaces](#sec-Unions.Unions-Implementing-Interfaces)).
1318+ Otherwise, type refining fragments or inline fragments must be used.
13181319
13191320For example, we might define the following types :
13201321
@@ -1399,6 +1400,22 @@ type Photo implements Resource {
13991400}
14001401```
14011402
1403+ The following query would then be valid :
1404+
1405+ ```graphql example
1406+ {
1407+ firstSearchResult {
1408+ url
1409+ ... on Article {
1410+ title
1411+ }
1412+ ... on Photo {
1413+ height
1414+ }
1415+ }
1416+ }
1417+ ```
1418+
14021419Transitively implemented interfaces (interfaces implemented by the interface
14031420that is being implemented) must also be defined on the implementing union . For
14041421example , `SearchResult ` cannot implement `Resource ` without also implementing
0 commit comments