@@ -1373,18 +1373,22 @@ union SearchResult =
1373
1373
**Unions of Interfaces and Unions **
1374
1374
1375
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 :
1376
+ included types must also be explicitly included within the parent union , i .e . if
1377
+ a parent union includes a child union , all types included by the child union
1378
+ must be explicitly included by the parent union . Similarly , if a union includes
1379
+ an interface , all types implementing the interface must be explicitly included
1380
+ by the union .
1381
+
1382
+ For example , the following types are valid :
1379
1383
1380
1384
```graphql example
1381
- union SearchResult = Item | Photo | Video | Named
1385
+ union SearchResult = Item | Photo | Video | Named | Person
1382
1386
1383
1387
interface Named {
1384
1388
name : String
1385
1389
}
1386
1390
1387
- type Person {
1391
+ type Person implements Named {
1388
1392
name : String
1389
1393
age : Int
1390
1394
}
@@ -1426,11 +1430,18 @@ And, given the above, the following operation is valid:
1426
1430
}
1427
1431
```
1428
1432
1429
- While the following union is invalid , because the member types of `Item ` are not
1430
- explicitly included within `SearchResult `:
1433
+ While the following union is invalid , because `Photo ` and `Video ` are contained
1434
+ by the union `Item ` and are not explicitly included within `SearchResult `:
1435
+
1436
+ ```graphql counter -example
1437
+ union SearchResult = Item | Named | Person
1438
+ ```
1439
+
1440
+ The following union is also invalid , because `Person ` implements `Named `, but is
1441
+ not explicitly included within `SearchResult `:
1431
1442
1432
1443
```graphql counter -example
1433
- union SearchResult = Item | Named
1444
+ union SearchResult = Item | Photo | Video | Named
1434
1445
```
1435
1446
1436
1447
**Result Coercion **
0 commit comments