Skip to content

Commit

Permalink
fixed inputs_for_require to use the entity_type/schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
duckki committed Jun 15, 2024
1 parent b4326a3 commit 0007fc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 4 additions & 1 deletion apollo-federation/src/query_plan/fetch_dependency_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3856,6 +3856,7 @@ fn handle_requires(
let inputs = inputs_for_require(
dependency_graph,
entity_type_position.clone(),
entity_type_schema,
query_graph_edge_id,
context,
false,
Expand Down Expand Up @@ -4028,6 +4029,7 @@ fn defer_context_for_conditions(base_context: &DeferContext) -> DeferContext {
fn inputs_for_require(
fetch_dependency_graph: &mut FetchDependencyGraph,
entity_type_position: ObjectTypeDefinitionPosition,
entity_type_schema: ValidFederationSchema,
query_graph_edge_id: EdgeIndex,
context: &OpGraphPathContext,
include_key_inputs: bool,
Expand Down Expand Up @@ -4112,7 +4114,7 @@ fn inputs_for_require(
// should just use `entity_type` (that @interfaceObject type), not input type which will be an implementation the
// subgraph does not know in that particular case.
let mut key_inputs =
SelectionSet::for_composite_type(edge_conditions.schema.clone(), input_type.clone());
SelectionSet::for_composite_type(entity_type_schema, entity_type_position.into());
key_inputs.add_selection_set(&key_condition)?;

Ok((
Expand Down Expand Up @@ -4152,6 +4154,7 @@ fn add_post_require_inputs(
let (inputs, key_inputs) = inputs_for_require(
dependency_graph,
entity_type_position.clone(),
entity_type_schema.clone(),
query_graph_edge_id,
context,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,8 @@ fn does_not_rely_on_an_interface_object_directly_for_typename() {
}

#[test]
#[should_panic(
expected = r#"Cannot add selection of field "I.id" to selection set of parent type "A""#
)]
// TODO: investigate this failure
// - Fails to rebase on an interface object type in a subgraph.
#[should_panic(expected = r#"snapshot assertion"#)]
// TODO: investigate this failure (missing fetch node for `iFromS2 { ... on I { y } }`)
fn does_not_rely_on_an_interface_object_directly_if_a_specific_implementation_is_requested() {
let planner = planner!(
S1: SUBGRAPH1,
Expand Down Expand Up @@ -426,11 +423,8 @@ fn handles_query_of_an_interface_field_for_a_specific_implementation_when_query_
}

#[test]
#[should_panic(
expected = r#"Cannot add selection of field "I.id" to selection set of parent type "A""#
)]
// TODO: investigate this failure
// - Fails to rebase on an interface object type in a subgraph.
#[should_panic(expected = r#"snapshot assertion"#)]
// TODO: investigate this failure (missing fetch node for "everything.@ { ... on I { expansiveField } }")
fn it_avoids_buffering_interface_object_results_that_may_have_to_be_filtered_with_lists() {
let planner = planner!(
S1: r#"
Expand Down

0 comments on commit 0007fc8

Please sign in to comment.