From 2ce65178e0b8bef405718e7abefb4556367946e3 Mon Sep 17 00:00:00 2001 From: TylerBloom Date: Sun, 3 Nov 2024 22:19:34 -0600 Subject: [PATCH] Rebase cleanup --- .../src/link/federation_spec_definition.rs | 53 +++++-------------- .../src/query_graph/build_query_graph.rs | 4 +- 2 files changed, 13 insertions(+), 44 deletions(-) diff --git a/apollo-federation/src/link/federation_spec_definition.rs b/apollo-federation/src/link/federation_spec_definition.rs index d81e8ca597..05eab6de18 100644 --- a/apollo-federation/src/link/federation_spec_definition.rs +++ b/apollo-federation/src/link/federation_spec_definition.rs @@ -71,14 +71,6 @@ pub(crate) struct OverrideDirectiveArguments<'doc> { pub(crate) label: Option<&'doc str>, } -pub(crate) struct ContextDirectiveArguments<'doc> { - pub(crate) name: &'doc str, -} - -pub(crate) struct FromContextDirectiveArguments<'doc> { - pub(crate) field: &'doc str, -} - #[derive(Debug)] pub(crate) struct FederationSpecDefinition { url: Url, @@ -349,27 +341,6 @@ impl FederationSpecDefinition { }) } - pub(crate) fn context_directive_arguments<'doc>( - &self, - application: &'doc Node, - ) -> Result, FederationError> { - Ok(ContextDirectiveArguments { - name: directive_required_string_argument(application, &FEDERATION_NAME_ARGUMENT_NAME)?, - }) - } - - pub(crate) fn from_context_directive_arguments<'doc>( - &self, - application: &'doc Node, - ) -> Result, FederationError> { - Ok(FromContextDirectiveArguments { - field: directive_required_string_argument( - application, - &FEDERATION_FIELD_ARGUMENT_NAME, - )?, - }) - } - pub(crate) fn provides_directive_arguments<'doc>( &self, application: &'doc Node, @@ -521,6 +492,18 @@ impl FederationSpecDefinition { }) } + pub(crate) fn from_context_directive_arguments<'doc>( + &self, + application: &'doc Node, + ) -> Result, FederationError> { + Ok(FromContextDirectiveArguments { + field: directive_required_string_argument( + application, + &FEDERATION_FIELD_ARGUMENT_NAME, + )?, + }) + } + pub(crate) fn from_context_directive( &self, schema: &FederationSchema, @@ -543,18 +526,6 @@ impl FederationSpecDefinition { }) } - pub(crate) fn from_context_directive_arguments<'doc>( - &self, - application: &'doc Node, - ) -> Result, FederationError> { - Ok(FromContextDirectiveArguments { - field: directive_required_string_argument( - application, - &FEDERATION_FIELD_ARGUMENT_NAME, - )?, - }) - } - pub(crate) fn get_cost_spec_definition( &self, schema: &FederationSchema, diff --git a/apollo-federation/src/query_graph/build_query_graph.rs b/apollo-federation/src/query_graph/build_query_graph.rs index ca62bf4811..286b715b2a 100644 --- a/apollo-federation/src/query_graph/build_query_graph.rs +++ b/apollo-federation/src/query_graph/build_query_graph.rs @@ -1536,9 +1536,7 @@ impl FederatedQueryGraphBuilder { for object_def_pos in &context_refs.object_types { let object = object_def_pos.get(subgraph.schema())?; for dir in object.directives.get_all(&CONTEXT_DIRECTIVE_NAME) { - let application = subgraph_data - .federation_spec_definition - .context_directive_arguments(dir)?; + let application = FederationSpecDefinition::context_directive_arguments(dir)?; context_name_to_types .entry(application.name) .or_default()