Skip to content

Commit

Permalink
Rebase cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBloom committed Nov 4, 2024
1 parent 490eb56 commit a757dfd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 44 deletions.
53 changes: 12 additions & 41 deletions apollo-federation/src/link/federation_spec_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -349,27 +341,6 @@ impl FederationSpecDefinition {
})
}

pub(crate) fn context_directive_arguments<'doc>(
&self,
application: &'doc Node<Directive>,
) -> Result<ContextDirectiveArguments<'doc>, 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<Directive>,
) -> Result<FromContextDirectiveArguments<'doc>, FederationError> {
Ok(FromContextDirectiveArguments {
field: directive_required_string_argument(
application,
&FEDERATION_FIELD_ARGUMENT_NAME,
)?,
})
}

pub(crate) fn provides_directive_arguments<'doc>(
&self,
application: &'doc Node<Directive>,
Expand Down Expand Up @@ -521,6 +492,18 @@ impl FederationSpecDefinition {
})
}

pub(crate) fn from_context_directive_arguments<'doc>(
&self,
application: &'doc Node<Directive>,
) -> Result<FromContextDirectiveArguments<'doc>, FederationError> {
Ok(FromContextDirectiveArguments {
field: directive_required_string_argument(
application,
&FEDERATION_FIELD_ARGUMENT_NAME,
)?,
})
}

pub(crate) fn from_context_directive(
&self,
schema: &FederationSchema,
Expand All @@ -543,18 +526,6 @@ impl FederationSpecDefinition {
})
}

pub(crate) fn from_context_directive_arguments<'doc>(
&self,
application: &'doc Node<Directive>,
) -> Result<FromContextDirectiveArguments<'doc>, FederationError> {
Ok(FromContextDirectiveArguments {
field: directive_required_string_argument(
application,
&FEDERATION_FIELD_ARGUMENT_NAME,
)?,
})
}

pub(crate) fn get_cost_spec_definition(
&self,
schema: &FederationSchema,
Expand Down
4 changes: 1 addition & 3 deletions apollo-federation/src/query_graph/build_query_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a757dfd

Please sign in to comment.