Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changesets/fix_customer_snore_infant_wrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Allow to use progressive override with federation 2.7 and above ([PR #5754](https://github.com/apollographql/router/pull/5754))

The progressive override feature is now properly available using federation 2.7 and above.

By [@o0ignition0o](https://github.com/o0ignition0o) in https://github.com/apollographql/router/pull/5754
2 changes: 1 addition & 1 deletion apollo-router/src/plugins/progressive_override/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) const LABELS_TO_OVERRIDE_KEY: &str = "apollo_override::labels_to_over

pub(crate) const JOIN_FIELD_DIRECTIVE_NAME: &str = "join__field";
pub(crate) const JOIN_SPEC_BASE_URL: &str = "https://specs.apollo.dev/join";
pub(crate) const JOIN_SPEC_VERSION_RANGE: &str = ">=0.4.0, <=0.4.0";
pub(crate) const JOIN_SPEC_VERSION_RANGE: &str = ">=0.4";
pub(crate) const OVERRIDE_LABEL_ARG_NAME: &str = "overrideLabel";

/// Configuration for the progressive override plugin
Expand Down
47 changes: 47 additions & 0 deletions apollo-router/src/plugins/progressive_override/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::sync::Arc;

use apollo_compiler::Schema;
use tower::ServiceExt;

use crate::metrics::FutureMetricsExt;
Expand All @@ -9,6 +10,9 @@ use crate::plugin::Plugin;
use crate::plugin::PluginInit;
use crate::plugins::progressive_override::Config;
use crate::plugins::progressive_override::ProgressiveOverridePlugin;
use crate::plugins::progressive_override::JOIN_FIELD_DIRECTIVE_NAME;
use crate::plugins::progressive_override::JOIN_SPEC_BASE_URL;
use crate::plugins::progressive_override::JOIN_SPEC_VERSION_RANGE;
use crate::plugins::progressive_override::LABELS_TO_OVERRIDE_KEY;
use crate::plugins::progressive_override::UNRESOLVED_LABELS_KEY;
use crate::services::layers::query_analysis::ParsedDocument;
Expand All @@ -22,6 +26,49 @@ use crate::TestHarness;
const SCHEMA: &str = include_str!("testdata/supergraph.graphql");
const SCHEMA_NO_USAGES: &str = include_str!("testdata/supergraph_no_usages.graphql");

#[test]
fn test_progressive_overrides_are_recognised_vor_join_v0_4_and_above() {
let schema_for_version = |version| {
format!(
r#"schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/{}", for: EXECUTION)
@link(url: "https://specs.apollo.dev/context/v0.1", for: SECURITY)

directive @join__field repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION"#,
version
)
};

let join_v3_schema = Schema::parse(schema_for_version("v0.3"), "test").unwrap();
assert!(crate::spec::Schema::directive_name(
&join_v3_schema,
JOIN_SPEC_BASE_URL,
JOIN_SPEC_VERSION_RANGE,
JOIN_FIELD_DIRECTIVE_NAME,
)
.is_none());

let join_v4_schema = Schema::parse(schema_for_version("v0.4"), "test").unwrap();
assert!(crate::spec::Schema::directive_name(
&join_v4_schema,
JOIN_SPEC_BASE_URL,
JOIN_SPEC_VERSION_RANGE,
JOIN_FIELD_DIRECTIVE_NAME,
)
.is_some());

let join_v5_schema = Schema::parse(schema_for_version("v0.5"), "test").unwrap();

assert!(crate::spec::Schema::directive_name(
&join_v5_schema,
JOIN_SPEC_BASE_URL,
JOIN_SPEC_VERSION_RANGE,
JOIN_FIELD_DIRECTIVE_NAME,
)
.is_some())
}

#[tokio::test]
async fn plugin_disables_itself_with_no_progressive_override_usages() {
let plugin = ProgressiveOverridePlugin::new(PluginInit::fake_new(
Expand Down