Skip to content

Commit

Permalink
Avoid a double map lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Oct 19, 2023
1 parent 4908f85 commit 1d9e065
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions apollo-router/src/spec/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::sync::Arc;

use apollo_compiler::ast;
use apollo_compiler::executable;
use apollo_compiler::schema::ExtendedType;
use apollo_compiler::ExecutableDocument;
use derivative::Derivative;
use indexmap::IndexSet;
Expand Down Expand Up @@ -526,16 +527,8 @@ impl Query {
// be inadvertently leaking some data for an @inacessible type or something, nullify the whole object. However, do note that due to `@interfaceObject`,
// some subgraph can have returned a __typename that is the name of an interface in the supergraph, and this is fine (that is, we should not
// return such a __typename to the user, but as long as it's not returned, having it in the internal data is ok and sometimes expected).
if parameters
.schema
.definitions
.get_object(input_type)
.is_none()
&& parameters
.schema
.definitions
.get_interface(input_type)
.is_none()
if let Some(ExtendedType::Object(_) | ExtendedType::Interface(_)) =
parameters.schema.definitions.types.get(input_type)
{
parameters.nullified.push(Path::from_response_slice(path));
*output = Value::Null;
Expand Down

0 comments on commit 1d9e065

Please sign in to comment.