@@ -26,6 +26,7 @@ describe('Introspection', () => {
26
26
descriptions : false ,
27
27
specifiedByUrl : true ,
28
28
directiveIsRepeatable : true ,
29
+ memberTypes : true ,
29
30
} ) ;
30
31
31
32
const result = graphqlSync ( { schema, source } ) ;
@@ -56,6 +57,7 @@ describe('Introspection', () => {
56
57
inputFields : null ,
57
58
interfaces : [ ] ,
58
59
enumValues : null ,
60
+ memberTypes : null ,
59
61
possibleTypes : null ,
60
62
} ,
61
63
{
@@ -66,6 +68,7 @@ describe('Introspection', () => {
66
68
inputFields : null ,
67
69
interfaces : null ,
68
70
enumValues : null ,
71
+ memberTypes : null ,
69
72
possibleTypes : null ,
70
73
} ,
71
74
{
@@ -76,6 +79,7 @@ describe('Introspection', () => {
76
79
inputFields : null ,
77
80
interfaces : null ,
78
81
enumValues : null ,
82
+ memberTypes : null ,
79
83
possibleTypes : null ,
80
84
} ,
81
85
{
@@ -181,6 +185,7 @@ describe('Introspection', () => {
181
185
inputFields : null ,
182
186
interfaces : [ ] ,
183
187
enumValues : null ,
188
+ memberTypes : null ,
184
189
possibleTypes : null ,
185
190
} ,
186
191
{
@@ -284,6 +289,25 @@ describe('Introspection', () => {
284
289
isDeprecated : false ,
285
290
deprecationReason : null ,
286
291
} ,
292
+ {
293
+ name : 'memberTypes' ,
294
+ args : [ ] ,
295
+ type : {
296
+ kind : 'LIST' ,
297
+ name : null ,
298
+ ofType : {
299
+ kind : 'NON_NULL' ,
300
+ name : null ,
301
+ ofType : {
302
+ kind : 'OBJECT' ,
303
+ name : '__Type' ,
304
+ ofType : null ,
305
+ } ,
306
+ } ,
307
+ } ,
308
+ isDeprecated : false ,
309
+ deprecationReason : null ,
310
+ } ,
287
311
{
288
312
name : 'possibleTypes' ,
289
313
args : [ ] ,
@@ -376,6 +400,7 @@ describe('Introspection', () => {
376
400
inputFields : null ,
377
401
interfaces : [ ] ,
378
402
enumValues : null ,
403
+ memberTypes : null ,
379
404
possibleTypes : null ,
380
405
} ,
381
406
{
@@ -427,6 +452,7 @@ describe('Introspection', () => {
427
452
deprecationReason : null ,
428
453
} ,
429
454
] ,
455
+ memberTypes : null ,
430
456
possibleTypes : null ,
431
457
} ,
432
458
{
@@ -538,6 +564,7 @@ describe('Introspection', () => {
538
564
inputFields : null ,
539
565
interfaces : [ ] ,
540
566
enumValues : null ,
567
+ memberTypes : null ,
541
568
possibleTypes : null ,
542
569
} ,
543
570
{
@@ -627,6 +654,7 @@ describe('Introspection', () => {
627
654
inputFields : null ,
628
655
interfaces : [ ] ,
629
656
enumValues : null ,
657
+ memberTypes : null ,
630
658
possibleTypes : null ,
631
659
} ,
632
660
{
@@ -690,6 +718,7 @@ describe('Introspection', () => {
690
718
inputFields : null ,
691
719
interfaces : [ ] ,
692
720
enumValues : null ,
721
+ memberTypes : null ,
693
722
possibleTypes : null ,
694
723
} ,
695
724
{
@@ -798,6 +827,7 @@ describe('Introspection', () => {
798
827
inputFields : null ,
799
828
interfaces : [ ] ,
800
829
enumValues : null ,
830
+ memberTypes : null ,
801
831
possibleTypes : null ,
802
832
} ,
803
833
{
@@ -904,6 +934,7 @@ describe('Introspection', () => {
904
934
deprecationReason : null ,
905
935
} ,
906
936
] ,
937
+ memberTypes : null ,
907
938
possibleTypes : null ,
908
939
} ,
909
940
] ,
@@ -1612,6 +1643,68 @@ describe('Introspection', () => {
1612
1643
} ) ;
1613
1644
} ) ;
1614
1645
1646
+ it ( 'exposes memberTypes for Union types' , ( ) => {
1647
+ const schema = buildSchema ( `
1648
+ union SomeUnion = SomeObject
1649
+
1650
+ union AnotherUnion = SomeUnion | SomeObject
1651
+
1652
+ type SomeObject {
1653
+ someField(arg: String): String
1654
+ }
1655
+
1656
+ schema {
1657
+ query: SomeObject
1658
+ }
1659
+ ` ) ;
1660
+
1661
+ const source = `
1662
+ {
1663
+ SomeObject: __type(name: "SomeObject") {
1664
+ memberTypes {
1665
+ name
1666
+ }
1667
+ possibleTypes {
1668
+ name
1669
+ }
1670
+ }
1671
+ SomeUnion: __type(name: "SomeUnion") {
1672
+ memberTypes {
1673
+ name
1674
+ }
1675
+ possibleTypes {
1676
+ name
1677
+ }
1678
+ }
1679
+ AnotherUnion: __type(name: "AnotherUnion") {
1680
+ memberTypes {
1681
+ name
1682
+ }
1683
+ possibleTypes {
1684
+ name
1685
+ }
1686
+ }
1687
+ }
1688
+ ` ;
1689
+
1690
+ expect ( graphqlSync ( { schema, source } ) ) . to . deep . equal ( {
1691
+ data : {
1692
+ SomeObject : {
1693
+ memberTypes : null ,
1694
+ possibleTypes : null ,
1695
+ } ,
1696
+ SomeUnion : {
1697
+ memberTypes : [ { name : 'SomeObject' } ] ,
1698
+ possibleTypes : [ { name : 'SomeObject' } ] ,
1699
+ } ,
1700
+ AnotherUnion : {
1701
+ memberTypes : [ { name : 'SomeUnion' } , { name : 'SomeObject' } ] ,
1702
+ possibleTypes : [ { name : 'SomeObject' } ] ,
1703
+ } ,
1704
+ } ,
1705
+ } ) ;
1706
+ } ) ;
1707
+
1615
1708
it ( 'executes an introspection query without calling global resolvers' , ( ) => {
1616
1709
const schema = buildSchema ( `
1617
1710
type Query {
@@ -1623,6 +1716,7 @@ describe('Introspection', () => {
1623
1716
specifiedByUrl : true ,
1624
1717
directiveIsRepeatable : true ,
1625
1718
schemaDescription : true ,
1719
+ memberTypes : true ,
1626
1720
} ) ;
1627
1721
1628
1722
/* c8 ignore start */
0 commit comments