@@ -1372,12 +1372,13 @@ union SearchResult =
13721372
13731373**Unions of Interfaces and Unions **
13741374
1375- A Union may declare interfaces or other unions as member types . The parent
1376- Union 's possible types transitively include all the possible types of any
1377- abstract member types . For example , the following types are valid :
1375+ A Union may declare interfaces or other unions as member types . Transitively
1376+ included object types (object types included within a union included by a union)
1377+ must also be included within the parent union . For example , the following types
1378+ are valid :
13781379
13791380```graphql example
1380- union SearchResult = Photo | Named
1381+ union SearchResult = Item | Photo | Video | Named
13811382
13821383interface Named {
13831384 name : String
@@ -1425,6 +1426,13 @@ And, given the above, the following operation is valid:
14251426}
14261427```
14271428
1429+ While the following union is invalid , because the member types of `Item ` are not
1430+ explicitly included within `SearchResult `:
1431+
1432+ ```graphql counter -example
1433+ union SearchResult = Item | Named
1434+ ```
1435+
14281436**Result Coercion **
14291437
14301438The union type should have some way of determining which object a given result
@@ -1443,6 +1451,12 @@ Union types have the potential to be invalid if incorrectly defined.
144314512. The member types of a Union type must all be Object , Interface or Union
14441452 types ; Scalar and Enum types must not be member types of a Union . Similarly ,
14451453 wrapping types must not be member types of a Union .
1454+ 3. A parent Union must explicitly include as member types of all child Union
1455+ members .
1456+ 1. Let this union type be {unionType }.
1457+ 2. For each {memberType } declared as a member of {unionType }, if {memberType }
1458+ is a Union type , all of the members of {memberType } must also be members
1459+ of {unionType }.
14461460
14471461### Union Extensions
14481462
@@ -1469,6 +1483,12 @@ Union type extensions have the potential to be invalid if incorrectly defined.
14691483 the original Union type .
147014845. Any non -repeatable directives provided must not already apply to the original
14711485 Union type .
1486+ 6. A parent Union must explicitly include as member types of all child Union
1487+ members .
1488+ 1. Let this union type be {unionType }.
1489+ 2. For each {memberType } declared as a member of {unionType }, if {memberType }
1490+ is a Union type , all of the members of {memberType } must also be members
1491+ of {unionType }.
14721492
14731493## Enums
14741494
0 commit comments