Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added logic to parse @context in FederatedQueryGraphBuilder::build #6223

Open
wants to merge 9 commits into
base: router-528-impl-set-context
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ dependencies = [
"multimap 0.10.0",
"nom",
"petgraph",
"regex",
"ron",
"serde",
"serde_json_bytes",
Expand Down Expand Up @@ -2927,8 +2928,8 @@ dependencies = [
"aho-corasick",
"bstr",
"log",
"regex-automata 0.4.7",
"regex-syntax 0.8.4",
"regex-automata 0.4.8",
"regex-syntax 0.8.5",
]

[[package]]
Expand Down Expand Up @@ -5288,14 +5289,14 @@ dependencies = [

[[package]]
name = "regex"
version = "1.10.5"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata 0.4.7",
"regex-syntax 0.8.4",
"regex-automata 0.4.8",
"regex-syntax 0.8.5",
]

[[package]]
Expand All @@ -5309,13 +5310,13 @@ dependencies = [

[[package]]
name = "regex-automata"
version = "0.4.7"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax 0.8.4",
"regex-syntax 0.8.5",
]

[[package]]
Expand All @@ -5332,9 +5333,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"

[[package]]
name = "regex-syntax"
version = "0.8.4"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"

[[package]]
name = "reqwest"
Expand Down
1 change: 1 addition & 0 deletions apollo-federation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ url = "2"
tracing = "0.1.40"
ron = { version = "0.8.1", optional = true }
either = "1.13.0"
regex = "1.11.1"

[dev-dependencies]
hex.workspace = true
Expand Down
34 changes: 17 additions & 17 deletions apollo-federation/src/link/federation_spec_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ pub(crate) struct ProvidesDirectiveArguments<'doc> {
pub(crate) fields: &'doc str,
}

pub(crate) struct OverrideDirectiveArguments<'doc> {
pub(crate) from: &'doc str,
pub(crate) label: Option<&'doc str>,
}

pub(crate) struct ContextDirectiveArguments<'doc> {
pub(crate) name: &'doc str,
}
Expand All @@ -71,6 +66,11 @@ pub(crate) struct FromContextDirectiveArguments<'doc> {
pub(crate) field: &'doc str,
}

pub(crate) struct OverrideDirectiveArguments<'doc> {
pub(crate) from: &'doc str,
pub(crate) label: Option<&'doc str>,
}

#[derive(Debug)]
pub(crate) struct FederationSpecDefinition {
url: Url,
Expand Down Expand Up @@ -492,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 @@ -514,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
Loading