@@ -6,7 +6,10 @@ use selection::{Selection, SelectionItem};
66use std:: collections:: BTreeSet ;
77
88#[ derive( Debug , PartialEq ) ]
9- pub struct GqlUnion ( pub BTreeSet < String > ) ;
9+ pub struct GqlUnion {
10+ pub description : Option < String > ,
11+ pub variants : BTreeSet < String > ,
12+ }
1013
1114#[ derive( Debug , Fail ) ]
1215#[ fail( display = "UnionError" ) ]
@@ -109,7 +112,7 @@ impl GqlUnion {
109112 union_variants ( selection, query_context, prefix) ?;
110113
111114 variants. extend (
112- self . 0
115+ self . variants
113116 . iter ( )
114117 . filter ( |v| used_variants. iter ( ) . find ( |a| a == v) . is_none ( ) )
115118 . map ( |v| {
@@ -158,7 +161,10 @@ mod tests {
158161 let mut context = QueryContext :: new_empty ( ) ;
159162 let selection = Selection ( fields) ;
160163 let prefix = "Meow" ;
161- let union = GqlUnion ( BTreeSet :: new ( ) ) ;
164+ let union = GqlUnion {
165+ description : None ,
166+ variants : BTreeSet :: new ( ) ,
167+ } ;
162168
163169 context. schema . objects . insert (
164170 "User" . to_string ( ) ,
@@ -240,7 +246,10 @@ mod tests {
240246 let mut context = QueryContext :: new_empty ( ) ;
241247 let selection = Selection ( fields) ;
242248 let prefix = "Meow" ;
243- let union = GqlUnion ( BTreeSet :: new ( ) ) ;
249+ let union = GqlUnion {
250+ description : None ,
251+ variants : BTreeSet :: new ( ) ,
252+ } ;
244253
245254 let result = union. response_for_selection ( & context, & selection, & prefix) ;
246255
0 commit comments