@@ -16,7 +16,6 @@ use graph::prelude::{
16
16
} ;
17
17
18
18
use crate :: execution:: ast as a;
19
- use crate :: introspection:: introspection_schema;
20
19
use crate :: query:: { ast as qast, ext:: BlockConstraint } ;
21
20
use crate :: schema:: ast as sast;
22
21
use crate :: {
@@ -98,7 +97,6 @@ pub struct Query {
98
97
pub query_text : Arc < String > ,
99
98
pub variables_text : Arc < String > ,
100
99
pub query_id : String ,
101
- pub ( crate ) complexity : u64 ,
102
100
}
103
101
104
102
impl Query {
@@ -168,9 +166,11 @@ impl Query {
168
166
fragments,
169
167
} ;
170
168
171
- // It's important to check complexity first, so `validate_fields` doesn't risk a stack
172
- // overflow from invalid queries.
173
- let complexity = raw_query. check_complexity ( max_complexity, max_depth) ?;
169
+ // It's important to check complexity first, so `validate_fields`
170
+ // doesn't risk a stack overflow from invalid queries. We don't
171
+ // really care about the resulting complexity, only that all the
172
+ // checks that `check_complexity` performs pass successfully
173
+ let _ = raw_query. check_complexity ( max_complexity, max_depth) ?;
174
174
raw_query. validate_fields ( ) ?;
175
175
let ( selection_set, fragments) = raw_query. expand_variables ( ) ?;
176
176
@@ -186,7 +186,6 @@ impl Query {
186
186
query_text : query. query_text . cheap_clone ( ) ,
187
187
variables_text : query. variables_text . cheap_clone ( ) ,
188
188
query_id,
189
- complexity,
190
189
} ;
191
190
192
191
Ok ( Arc :: new ( query) )
@@ -259,26 +258,6 @@ impl Query {
259
258
}
260
259
}
261
260
262
- /// Return this query, but use the introspection schema as its schema
263
- pub fn as_introspection_query ( & self ) -> Arc < Self > {
264
- let introspection_schema = introspection_schema ( self . schema . id ( ) . clone ( ) ) ;
265
-
266
- Arc :: new ( Self {
267
- schema : Arc :: new ( introspection_schema) ,
268
- fragments : self . fragments . clone ( ) ,
269
- selection_set : self . selection_set . clone ( ) ,
270
- shape_hash : self . shape_hash ,
271
- kind : self . kind ,
272
- network : self . network . clone ( ) ,
273
- logger : self . logger . clone ( ) ,
274
- start : self . start ,
275
- query_text : self . query_text . clone ( ) ,
276
- variables_text : self . variables_text . clone ( ) ,
277
- query_id : self . query_id . clone ( ) ,
278
- complexity : self . complexity ,
279
- } )
280
- }
281
-
282
261
/// Should only be called for fragments that exist in the query, and therefore have been
283
262
/// validated to exist. Panics otherwise.
284
263
pub fn get_fragment ( & self , name : & str ) -> & a:: FragmentDefinition {
0 commit comments