@@ -172,6 +172,7 @@ where
172
172
pub fn execute_root_selection_set (
173
173
ctx : & ExecutionContext < impl Resolver > ,
174
174
selection_set : & q:: SelectionSet ,
175
+ root_type : & s:: ObjectType ,
175
176
) -> Result < BTreeMap < String , q:: Value > , Vec < QueryExecutionError > > {
176
177
// Cache the cache key to not have to calculate it twice - once for lookup
177
178
// and once for insert.
@@ -193,12 +194,6 @@ pub fn execute_root_selection_set(
193
194
}
194
195
}
195
196
196
- // Obtain the root Query type and fail if there isn't one
197
- let query_type = match sast:: get_root_query_type ( & ctx. query . schema . document ) {
198
- Some ( t) => t,
199
- None => return Err ( vec ! [ QueryExecutionError :: NoRootQueryObjectType ] ) ,
200
- } ;
201
-
202
197
// Split the toplevel fields into introspection fields and
203
198
// regular data fields
204
199
let mut data_set = q:: SelectionSet {
@@ -210,7 +205,7 @@ pub fn execute_root_selection_set(
210
205
items : Vec :: new ( ) ,
211
206
} ;
212
207
213
- for ( _, fields) in collect_fields ( ctx, query_type , iter:: once ( selection_set) , None ) {
208
+ for ( _, fields) in collect_fields ( ctx, root_type , iter:: once ( selection_set) , None ) {
214
209
let name = fields[ 0 ] . name . clone ( ) ;
215
210
let selections = fields. into_iter ( ) . map ( |f| q:: Selection :: Field ( f. clone ( ) ) ) ;
216
211
// See if this is an introspection or data field. We don't worry about
@@ -228,7 +223,7 @@ pub fn execute_root_selection_set(
228
223
BTreeMap :: default ( )
229
224
} else {
230
225
let initial_data = ctx. resolver . prefetch ( & ctx, selection_set) ?;
231
- execute_selection_set_to_map ( & ctx, iter:: once ( & data_set) , query_type , initial_data) ?
226
+ execute_selection_set_to_map ( & ctx, iter:: once ( & data_set) , root_type , initial_data) ?
232
227
} ;
233
228
234
229
// Resolve introspection fields, if there are any
@@ -255,7 +250,7 @@ pub fn execute_root_selection_set(
255
250
/// Executes a selection set, requiring the result to be of the given object type.
256
251
///
257
252
/// Allows passing in a parent value during recursive processing of objects and their fields.
258
- pub fn execute_selection_set < ' a > (
253
+ fn execute_selection_set < ' a > (
259
254
ctx : & ' a ExecutionContext < impl Resolver > ,
260
255
selection_sets : impl Iterator < Item = & ' a q:: SelectionSet > ,
261
256
object_type : & s:: ObjectType ,
0 commit comments