diff --git a/apollo-federation/Cargo.toml b/apollo-federation/Cargo.toml index 29dac5f7a6..daeb36e170 100644 --- a/apollo-federation/Cargo.toml +++ b/apollo-federation/Cargo.toml @@ -17,7 +17,6 @@ autotests = false # Integration tests are m snapshot_tracing = ["ron"] # `correctness` feature enables the `correctness` module. correctness = [] -"connect_v0.2" = [] [dependencies] apollo-compiler.workspace = true diff --git a/apollo-federation/src/sources/connect/models.rs b/apollo-federation/src/sources/connect/models.rs index f924753d0f..21a22dd0a3 100644 --- a/apollo-federation/src/sources/connect/models.rs +++ b/apollo-federation/src/sources/connect/models.rs @@ -25,7 +25,6 @@ use super::id::ConnectorPosition; use super::json_selection::ExternalVarPaths; use super::spec::schema::ConnectDirectiveArguments; use super::spec::schema::SourceDirectiveArguments; -use super::spec::versions::VersionInfo; use super::variable::Namespace; use super::variable::VariableReference; use crate::error::FederationError; @@ -113,14 +112,11 @@ impl Connector { return Ok(Default::default()); }; - let version: VersionInfo = spec.into(); - let source_name = ConnectSpec::source_directive_name(&link); - let source_arguments = extract_source_directive_arguments(schema, &source_name, &version)?; + let source_arguments = extract_source_directive_arguments(schema, &source_name)?; let connect_name = ConnectSpec::connect_directive_name(&link); - let connect_arguments = - extract_connect_directive_arguments(schema, &connect_name, &version)?; + let connect_arguments = extract_connect_directive_arguments(schema, &connect_name)?; connect_arguments .into_iter() diff --git a/apollo-federation/src/sources/connect/models/http_json_transport.rs b/apollo-federation/src/sources/connect/models/http_json_transport.rs index a6a9e6c6f6..2ef0d6c537 100644 --- a/apollo-federation/src/sources/connect/models/http_json_transport.rs +++ b/apollo-federation/src/sources/connect/models/http_json_transport.rs @@ -12,6 +12,7 @@ use apollo_compiler::parser::SourceSpan; use either::Either; use http::HeaderName; use http::Uri; +use http::header; use http::uri::InvalidUri; use http::uri::InvalidUriParts; use http::uri::Parts; @@ -34,7 +35,6 @@ use crate::sources::connect::spec::schema::HEADERS_ARGUMENT_NAME; use crate::sources::connect::spec::schema::HTTP_HEADER_MAPPING_FROM_ARGUMENT_NAME; use crate::sources::connect::spec::schema::HTTP_HEADER_MAPPING_NAME_ARGUMENT_NAME; use crate::sources::connect::spec::schema::HTTP_HEADER_MAPPING_VALUE_ARGUMENT_NAME; -use crate::sources::connect::spec::versions::AllowedHeaders; use crate::sources::connect::string_template; use crate::sources::connect::string_template::UriString; use crate::sources::connect::string_template::write_value; @@ -362,14 +362,10 @@ impl<'a> Header<'a> { /// Get a list of headers from the `headers` argument in a `@connect` or `@source` directive. pub(crate) fn from_headers_arg( node: &'a Node, - allowed_headers: &AllowedHeaders, ) -> Vec>> { match (node.as_list(), node.as_object()) { - (Some(values), _) => values - .iter() - .map(|v| Self::from_single(v, allowed_headers)) - .collect(), - (None, Some(_)) => vec![Self::from_single(node, allowed_headers)], + (Some(values), _) => values.iter().map(Self::from_single).collect(), + (None, Some(_)) => vec![Self::from_single(node)], _ => vec![Err(HeaderParseError::Other { message: format!("`{HEADERS_ARGUMENT_NAME}` must be an object or list of objects"), node, @@ -378,10 +374,7 @@ impl<'a> Header<'a> { } /// Build a single [`Self`] from a single entry in the `headers` arg. - fn from_single( - node: &'a Node, - allowed_headers: &AllowedHeaders, - ) -> Result> { + fn from_single(node: &'a Node) -> Result> { let mappings = node.as_object().ok_or_else(|| HeaderParseError::Other { message: "the HTTP header mapping is not an object".to_string(), node, @@ -407,7 +400,7 @@ impl<'a> Header<'a> { node: name_node, })?; - if allowed_headers.header_name_is_reserved(&name) { + if RESERVED_HEADERS.contains(&name) { return Err(HeaderParseError::Other { message: format!("header '{name}' is reserved and cannot be set by a connector"), node: name_node, @@ -422,7 +415,7 @@ impl<'a> Header<'a> { .find(|(name, _value)| *name == HTTP_HEADER_MAPPING_VALUE_ARGUMENT_NAME); match (from, value) { - (Some(_), None) if allowed_headers.header_name_allowed_static(&name) => { + (Some(_), None) if STATIC_HEADERS.contains(&name) => { Err(HeaderParseError::Other{ message: format!( "header '{name}' can't be set with `{HTTP_HEADER_MAPPING_FROM_ARGUMENT_NAME}`, only with `{HTTP_HEADER_MAPPING_VALUE_ARGUMENT_NAME}`" ), node: name_node}) @@ -507,6 +500,22 @@ impl Display for HeaderParseError<'_> { impl Error for HeaderParseError<'_> {} +const RESERVED_HEADERS: [HeaderName; 11] = [ + header::CONNECTION, + header::PROXY_AUTHENTICATE, + header::PROXY_AUTHORIZATION, + header::TE, + header::TRAILER, + header::TRANSFER_ENCODING, + header::UPGRADE, + header::CONTENT_LENGTH, + header::CONTENT_ENCODING, + header::ACCEPT_ENCODING, + HeaderName::from_static("keep-alive"), +]; + +const STATIC_HEADERS: [HeaderName; 3] = [header::CONTENT_TYPE, header::ACCEPT, header::HOST]; + #[cfg(test)] mod test_make_uri { use std::str::FromStr; diff --git a/apollo-federation/src/sources/connect/spec/directives.rs b/apollo-federation/src/sources/connect/spec/directives.rs index c08e521bec..1cb5e976ab 100644 --- a/apollo-federation/src/sources/connect/spec/directives.rs +++ b/apollo-federation/src/sources/connect/spec/directives.rs @@ -20,7 +20,6 @@ use super::schema::SOURCE_BASE_URL_ARGUMENT_NAME; use super::schema::SOURCE_NAME_ARGUMENT_NAME; use super::schema::SourceDirectiveArguments; use super::schema::SourceHTTPArguments; -use super::versions::VersionInfo; use crate::error::FederationError; use crate::schema::position::InterfaceFieldDefinitionPosition; use crate::schema::position::ObjectOrInterfaceFieldDefinitionPosition; @@ -41,21 +40,19 @@ macro_rules! internal { pub(crate) fn extract_source_directive_arguments( schema: &Schema, name: &Name, - version_info: &VersionInfo, ) -> Result, FederationError> { schema .schema_definition .directives .iter() .filter(|directive| directive.name == *name) - .map(|d| SourceDirectiveArguments::from_directive(d, version_info)) + .map(SourceDirectiveArguments::from_directive) .collect() } pub(crate) fn extract_connect_directive_arguments( schema: &Schema, name: &Name, - version_info: &VersionInfo, ) -> Result, FederationError> { // connect on fields schema @@ -100,11 +97,7 @@ pub(crate) fn extract_connect_directive_arguments( directive_name: directive.name.clone(), directive_index: i, }); - ConnectDirectiveArguments::from_position_and_directive( - position, - directive, - version_info, - ) + ConnectDirectiveArguments::from_position_and_directive(position, directive) }) }) }) @@ -127,9 +120,7 @@ pub(crate) fn extract_connect_directive_arguments( directive_index: i, }); ConnectDirectiveArguments::from_position_and_directive( - position, - directive, - version_info, + position, directive, ) }) }), @@ -141,10 +132,7 @@ pub(crate) fn extract_connect_directive_arguments( type ObjectNode = [(Name, Node)]; impl SourceDirectiveArguments { - fn from_directive( - value: &Component, - version_info: &VersionInfo, - ) -> Result { + fn from_directive(value: &Component) -> Result { let args = &value.arguments; // We'll have to iterate over the arg list and keep the properties by their name @@ -161,7 +149,7 @@ impl SourceDirectiveArguments { let http_value = arg.value.as_object().ok_or_else(|| { internal!("`http` field in `@source` directive is not an object") })?; - let http_value = SourceHTTPArguments::from_values(http_value, version_info)?; + let http_value = SourceHTTPArguments::from_values(http_value)?; http = Some(http_value); } else { @@ -181,10 +169,7 @@ impl SourceDirectiveArguments { } impl SourceHTTPArguments { - fn from_values( - values: &ObjectNode, - version_info: &VersionInfo, - ) -> Result { + fn from_values(values: &ObjectNode) -> Result { let mut base_url = None; let mut headers = None; let mut path = None; @@ -204,7 +189,7 @@ impl SourceHTTPArguments { ); } else if name == HEADERS_ARGUMENT_NAME.as_str() { headers = Some( - Header::from_headers_arg(value, &version_info.allowed_headers) + Header::from_headers_arg(value) .into_iter() .map_ok(|Header { name, source, .. }| (name, source)) .try_collect() @@ -246,7 +231,6 @@ impl ConnectDirectiveArguments { fn from_position_and_directive( position: ConnectorPosition, value: &Node, - version_info: &VersionInfo, ) -> Result { let args = &value.arguments; @@ -270,7 +254,7 @@ impl ConnectDirectiveArguments { internal!("`http` field in `@connect` directive is not an object") })?; - http = Some(ConnectHTTPArguments::from_values(http_value, version_info)?); + http = Some(ConnectHTTPArguments::from_values(http_value)?); } else if arg_name == "batch" { let http_value = arg.value.as_object().ok_or_else(|| { internal!("`http` field in `@connect` directive is not an object") @@ -309,10 +293,7 @@ impl ConnectDirectiveArguments { } impl ConnectHTTPArguments { - fn from_values( - values: &ObjectNode, - version_info: &VersionInfo, - ) -> Result { + fn from_values(values: &ObjectNode) -> Result { let mut get = None; let mut post = None; let mut patch = None; @@ -332,7 +313,7 @@ impl ConnectHTTPArguments { body = Some(JSONSelection::parse(body_value).map_err(|e| internal!(e.message))?); } else if name == HEADERS_ARGUMENT_NAME.as_str() { headers = Some( - Header::from_headers_arg(value, &version_info.allowed_headers) + Header::from_headers_arg(value) .into_iter() .map_ok(|Header { name, source, .. }| (name, source)) .try_collect() @@ -420,7 +401,6 @@ mod tests { use crate::ValidFederationSubgraphs; use crate::schema::FederationSchema; - use crate::sources::connect::ConnectSpec; use crate::sources::connect::spec::schema::CONNECT_DIRECTIVE_NAME_IN_SPEC; use crate::sources::connect::spec::schema::SOURCE_DIRECTIVE_NAME_IN_SPEC; use crate::sources::connect::spec::schema::SourceDirectiveArguments; @@ -490,7 +470,7 @@ mod tests { insta::assert_snapshot!( actual_definition.to_string(), - @"directive @connect(source: String, http: connect__ConnectHTTP, batch: connect__ConnectBatch, selection: connect__JSONSelection!, entity: Boolean = false) repeatable on FIELD_DEFINITION" + @"directive @connect(source: String, http: connect__ConnectHTTP, batch: connect__ConnectBatch, selection: connect__JSONSelection!, entity: Boolean = false) repeatable on FIELD_DEFINITION | OBJECT" ); let fields = schema @@ -532,7 +512,7 @@ mod tests { .directives .iter() .filter(|directive| directive.name == SOURCE_DIRECTIVE_NAME_IN_SPEC) - .map(|d| SourceDirectiveArguments::from_directive(d, &ConnectSpec::V0_1.into())) + .map(SourceDirectiveArguments::from_directive) .collect(); insta::assert_debug_snapshot!( @@ -578,11 +558,7 @@ mod tests { let schema = &subgraph.schema; // Extract the connects from the schema definition and map them to their `Connect` equivalent - let connects = super::extract_connect_directive_arguments( - schema.schema(), - &name!(connect), - &ConnectSpec::V0_1.into(), - ); + let connects = super::extract_connect_directive_arguments(schema.schema(), &name!(connect)); insta::assert_debug_snapshot!( connects.unwrap(), diff --git a/apollo-federation/src/sources/connect/spec/mod.rs b/apollo-federation/src/sources/connect/spec/mod.rs index f8b2640fe9..fabc4cd497 100644 --- a/apollo-federation/src/sources/connect/spec/mod.rs +++ b/apollo-federation/src/sources/connect/spec/mod.rs @@ -17,7 +17,6 @@ mod directives; pub(crate) mod schema; mod type_and_directive_specifications; -pub(crate) mod versions; use std::fmt::Display; @@ -25,7 +24,6 @@ use apollo_compiler::Name; use apollo_compiler::Schema; use apollo_compiler::ast::Argument; use apollo_compiler::ast::Directive; -use apollo_compiler::ast::DirectiveLocation; use apollo_compiler::ast::Value; use apollo_compiler::name; pub(crate) use directives::extract_connect_directive_arguments; @@ -118,9 +116,7 @@ impl ConnectSpec { return Ok(()); }; - let spec = Self::try_from(&link.url.version)?; - - type_and_directive_specifications::check_or_add(&link, &spec, schema) + type_and_directive_specifications::check_or_add(&link, schema) } pub(crate) fn source_directive_name(link: &Link) -> Name { @@ -157,21 +153,6 @@ impl ConnectSpec { ], } } - - pub(crate) const fn connect_directive_locations(&self) -> &'static [DirectiveLocation] { - match self { - ConnectSpec::V0_1 => CONNECT_V0_1_LOCATIONS, - ConnectSpec::V0_2 => CONNECT_V0_2_LOCATIONS, - } - } - - pub(crate) const fn available() -> &'static [ConnectSpec] { - if cfg!(any(feature = "connect_v0.2", test)) { - &[ConnectSpec::V0_1, ConnectSpec::V0_2] - } else { - &[ConnectSpec::V0_1] - } - } } impl TryFrom<&Version> for ConnectSpec { @@ -179,7 +160,6 @@ impl TryFrom<&Version> for ConnectSpec { fn try_from(version: &Version) -> Result { match (version.major, version.minor) { (0, 1) => Ok(Self::V0_1), - #[cfg(any(feature = "connect_v0.2", test))] (0, 2) => Ok(Self::V0_2), _ => Err(SingleFederationError::UnknownLinkVersion { message: format!("Unknown connect version: {version}"), @@ -202,9 +182,3 @@ impl From for Version { } } } - -const CONNECT_V0_1_LOCATIONS: &[DirectiveLocation] = &[DirectiveLocation::FieldDefinition]; -const CONNECT_V0_2_LOCATIONS: &[DirectiveLocation] = &[ - DirectiveLocation::FieldDefinition, - DirectiveLocation::Object, -]; diff --git a/apollo-federation/src/sources/connect/spec/type_and_directive_specifications.rs b/apollo-federation/src/sources/connect/spec/type_and_directive_specifications.rs index 890f0adfb2..24ada64c0b 100644 --- a/apollo-federation/src/sources/connect/spec/type_and_directive_specifications.rs +++ b/apollo-federation/src/sources/connect/spec/type_and_directive_specifications.rs @@ -44,7 +44,6 @@ use crate::sources::connect::spec::schema::SOURCE_BASE_URL_ARGUMENT_NAME; pub(super) fn check_or_add( link: &Link, - spec: &ConnectSpec, schema: &mut FederationSchema, ) -> Result<(), FederationError> { // the `get_type` closure expects a SingleFederationError, so we can't @@ -316,7 +315,10 @@ pub(super) fn check_or_add( }, ], true, - spec.connect_directive_locations(), + &[ + DirectiveLocation::FieldDefinition, + DirectiveLocation::Object, + ], false, None, None, @@ -468,7 +470,7 @@ mod tests { .for_identity(&ConnectSpec::identity()) .unwrap(); - check_or_add(&link, &ConnectSpec::V0_1, &mut federation_schema).unwrap(); + check_or_add(&link, &mut federation_schema).unwrap(); assert_snapshot!(federation_schema.schema().serialize().to_string(), @r###" schema { @@ -479,7 +481,7 @@ mod tests { directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA - directive @connect(source: String, http: connect__ConnectHTTP, batch: connect__ConnectBatch, selection: connect__JSONSelection!, entity: Boolean = false) repeatable on FIELD_DEFINITION + directive @connect(source: String, http: connect__ConnectHTTP, batch: connect__ConnectBatch, selection: connect__JSONSelection!, entity: Boolean = false) repeatable on FIELD_DEFINITION | OBJECT directive @source(name: String!, http: connect__SourceHTTP) repeatable on SCHEMA @@ -548,7 +550,7 @@ mod tests { .for_identity(&ConnectSpec::identity()) .unwrap(); - check_or_add(&link, &ConnectSpec::V0_2, &mut federation_schema).unwrap(); + check_or_add(&link, &mut federation_schema).unwrap(); assert_snapshot!(federation_schema.schema().serialize().to_string(), @r###" schema { diff --git a/apollo-federation/src/sources/connect/spec/versions.rs b/apollo-federation/src/sources/connect/spec/versions.rs deleted file mode 100644 index 43179d447c..0000000000 --- a/apollo-federation/src/sources/connect/spec/versions.rs +++ /dev/null @@ -1,80 +0,0 @@ -use http::HeaderName; -use http::header; - -use super::ConnectSpec; - -/// Container for version-specific information -pub(crate) struct VersionInfo { - pub(crate) allowed_headers: AllowedHeaders, -} - -impl VersionInfo { - fn new(version: &ConnectSpec) -> Self { - Self { - allowed_headers: AllowedHeaders::new(version), - } - } -} - -impl From for VersionInfo { - fn from(version: ConnectSpec) -> Self { - Self::new(&version) - } -} - -/// Information about headers that differs between versions -pub(crate) struct AllowedHeaders { - reserved_headers: Vec, - static_headers: Vec, -} - -impl AllowedHeaders { - pub(crate) fn header_name_is_reserved(&self, header_name: &HeaderName) -> bool { - self.reserved_headers.contains(header_name) - } - - pub(crate) fn header_name_allowed_static(&self, header_name: &HeaderName) -> bool { - self.static_headers.contains(header_name) - } - - fn new(version: &ConnectSpec) -> Self { - match version { - ConnectSpec::V0_1 => Self { - reserved_headers: vec![ - header::CONNECTION, - header::PROXY_AUTHENTICATE, - header::PROXY_AUTHORIZATION, - header::TE, - header::TRAILER, - header::TRANSFER_ENCODING, - header::UPGRADE, - header::CONTENT_LENGTH, - header::CONTENT_ENCODING, - header::HOST, - header::ACCEPT_ENCODING, - KEEP_ALIVE.clone(), - ], - static_headers: vec![header::CONTENT_TYPE, header::ACCEPT], - }, - // moves Host to allow setting it via `value:` - ConnectSpec::V0_2 => Self { - reserved_headers: vec![ - header::CONNECTION, - header::PROXY_AUTHENTICATE, - header::PROXY_AUTHORIZATION, - header::TE, - header::TRAILER, - header::TRANSFER_ENCODING, - header::UPGRADE, - header::CONTENT_LENGTH, - header::CONTENT_ENCODING, - header::ACCEPT_ENCODING, - KEEP_ALIVE.clone(), - ], - static_headers: vec![header::CONTENT_TYPE, header::ACCEPT, header::HOST], - }, - } - } -} - -static KEEP_ALIVE: HeaderName = HeaderName::from_static("keep-alive"); diff --git a/apollo-federation/src/sources/connect/validation/connect.rs b/apollo-federation/src/sources/connect/validation/connect.rs index 9f1c0a69d5..e6e15f73e6 100644 --- a/apollo-federation/src/sources/connect/validation/connect.rs +++ b/apollo-federation/src/sources/connect/validation/connect.rs @@ -16,7 +16,6 @@ use super::coordinates::ConnectDirectiveCoordinate; use super::coordinates::connect_directive_name_coordinate; use super::coordinates::source_name_value_coordinate; use super::source::SourceName; -use crate::sources::connect::ConnectSpec; use crate::sources::connect::Namespace; use crate::sources::connect::id::ConnectedElement; use crate::sources::connect::id::ObjectCategory; @@ -130,27 +129,8 @@ impl<'schema> Connect<'schema> { .map(|coordinate| Self::parse(coordinate, schema, source_names)) .partition_result(); - let mut messages: Vec = messages.into_iter().flatten().collect(); + let messages: Vec = messages.into_iter().flatten().collect(); - // TODO: find a better place for feature gates like this - if schema.connect_link.spec == ConnectSpec::V0_1 - && connects - .iter() - .any(|connect| matches!(connect.coordinate.element, ConnectedElement::Type { .. })) - { - messages.push(Message { - code: Code::FeatureUnavailable, - message: format!( - "Using `@{connect_directive_name}` on `type {object_name}` requires connectors v0.2. Learn more at https://go.apollo.dev/connectors/changelog.", - object_name = object.name, - connect_directive_name = schema.connect_directive_name(), - ), - locations: object - .line_column_range(&schema.sources) - .into_iter() - .collect(), - }); - } (connects, messages) } diff --git a/apollo-federation/src/sources/connect/validation/graphql.rs b/apollo-federation/src/sources/connect/validation/graphql.rs index 0b2b87efd5..7f7c4863df 100644 --- a/apollo-federation/src/sources/connect/validation/graphql.rs +++ b/apollo-federation/src/sources/connect/validation/graphql.rs @@ -11,7 +11,6 @@ mod strings; pub(super) use strings::GraphQLString; -use crate::sources::connect::spec::versions::VersionInfo; use crate::sources::connect::validation::link::ConnectLink; pub(super) struct SchemaInfo<'schema> { @@ -19,7 +18,6 @@ pub(super) struct SchemaInfo<'schema> { len: usize, lookup: LineColLookup<'schema>, pub(crate) connect_link: ConnectLink<'schema>, - pub(crate) version_info: VersionInfo, /// A lookup map for the Shapes computed from GraphQL types. pub(crate) shape_lookup: IndexMap<&'schema str, Shape>, } @@ -30,13 +28,11 @@ impl<'schema> SchemaInfo<'schema> { src: &'schema str, connect_link: ConnectLink<'schema>, ) -> Self { - let version_info = connect_link.spec.into(); Self { schema, len: src.len(), lookup: LineColLookup::new(src), connect_link, - version_info, shape_lookup: shape::graphql::shapes_for_schema(schema), } } diff --git a/apollo-federation/src/sources/connect/validation/http/headers.rs b/apollo-federation/src/sources/connect/validation/http/headers.rs index 70253e5cbc..4a8ed6522f 100644 --- a/apollo-federation/src/sources/connect/validation/http/headers.rs +++ b/apollo-federation/src/sources/connect/validation/http/headers.rs @@ -39,7 +39,7 @@ impl<'schema> Headers<'schema> { #[allow(clippy::mutable_key_type)] let mut headers: IndexMap = IndexMap::new(); - for header in Header::from_headers_arg(headers_arg, &schema.version_info.allowed_headers) { + for header in Header::from_headers_arg(headers_arg) { let header = match header { Ok(header) => header, Err(err) => { diff --git a/apollo-federation/src/sources/connect/validation/link.rs b/apollo-federation/src/sources/connect/validation/link.rs index 1ecf593ae8..0ca8bb14ea 100644 --- a/apollo-federation/src/sources/connect/validation/link.rs +++ b/apollo-federation/src/sources/connect/validation/link.rs @@ -7,6 +7,7 @@ use apollo_compiler::Schema; use apollo_compiler::schema::Component; use apollo_compiler::schema::Directive; use itertools::Itertools; +use strum::IntoEnumIterator; use crate::link::Link; use crate::sources::connect::ConnectSpec; @@ -35,21 +36,10 @@ impl<'schema> ConnectLink<'schema> { let spec = match ConnectSpec::try_from(&link.url.version) { Err(err) => { - let available_versions = ConnectSpec::available(); - let message = if available_versions.len() == 1 { - // TODO: No need to branch here once multiple spec versions are available - format!("{err}; should be {version}.", version = ConnectSpec::V0_1) - } else { - // This won't happen today, but it's prepping for 0.2 so we don't forget - format!( - "{err}; should be one of {available_versions}.", - available_versions = available_versions - .iter() - .copied() - .map(ConnectSpec::as_str) - .join(", "), - ) - }; + let message = format!( + "{err}; should be one of {available_versions}.", + available_versions = ConnectSpec::iter().map(ConnectSpec::as_str).join(", "), + ); return Some(Err(Message { code: Code::UnknownConnectorsVersion, message, diff --git a/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@feature-gates__v0_1_connect_on_object.graphql.snap b/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@feature-gates__v0_1_connect_on_object.graphql.snap deleted file mode 100644 index f0d031aea6..0000000000 --- a/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@feature-gates__v0_1_connect_on_object.graphql.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: apollo-federation/src/sources/connect/validation/mod.rs -expression: "format!(\"{:#?}\", result.errors)" -input_file: apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_1_connect_on_object.graphql ---- -[ - Message { - code: FeatureUnavailable, - message: "Using `@connect` on `type Product` requires connectors v0.2. Learn more at https://go.apollo.dev/connectors/changelog.", - locations: [ - 13:1..19:2, - ], - }, -] diff --git a/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@feature-gates__v0_2_connect_on_object.graphql.snap b/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@feature-gates__v0_2_connect_on_object.graphql.snap deleted file mode 100644 index 4ac0b97d9f..0000000000 --- a/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@feature-gates__v0_2_connect_on_object.graphql.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: apollo-federation/src/sources/connect/validation/mod.rs -expression: "format!(\"{:#?}\", result.errors)" -input_file: apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_2_connect_on_object.graphql ---- -[] diff --git a/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@headers__disallowed_header_names.graphql.snap b/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@headers__disallowed_header_names.graphql.snap index a672444ed0..318e71c976 100644 --- a/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@headers__disallowed_header_names.graphql.snap +++ b/apollo-federation/src/sources/connect/validation/snapshots/validation_tests@headers__disallowed_header_names.graphql.snap @@ -69,7 +69,7 @@ input_file: apollo-federation/src/sources/connect/validation/test_data/headers/d }, Message { code: InvalidHeader, - message: "In `@source(http.headers:)` header 'host' is reserved and cannot be set by a connector", + message: "In `@source(http.headers:)` header 'host' can't be set with `from`, only with `value`", locations: [ 20:17..20:23, ], @@ -165,13 +165,6 @@ input_file: apollo-federation/src/sources/connect/validation/test_data/headers/d 41:17..41:35, ], }, - Message { - code: InvalidHeader, - message: "In `@source(http.headers:)` header 'host' is reserved and cannot be set by a connector", - locations: [ - 42:17..42:23, - ], - }, Message { code: InvalidHeader, message: "In `@source(http.headers:)` header 'accept-encoding' is reserved and cannot be set by a connector", diff --git a/apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_1_connect_on_object.graphql b/apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_1_connect_on_object.graphql deleted file mode 100644 index 93af39f150..0000000000 --- a/apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_1_connect_on_object.graphql +++ /dev/null @@ -1,19 +0,0 @@ -extend schema - @link(url: "https://specs.apollo.dev/federation/v2.10") - @link( - url: "https://specs.apollo.dev/connect/v0.1" - import: ["@source", "@connect"] - ) - -type Query { - products: [Product] - @connect(http: { GET: "http://localhost:4001/products" }, selection: "id") -} - -type Product - @connect( - http: { GET: "http://localhost:4001/products", body: "ids: $batch.id" } - selection: "id" - ) { - id: ID! -} diff --git a/apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_2_connect_on_object.graphql b/apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_2_connect_on_object.graphql deleted file mode 100644 index ea56e6c7cb..0000000000 --- a/apollo-federation/src/sources/connect/validation/test_data/feature-gates/v0_2_connect_on_object.graphql +++ /dev/null @@ -1,19 +0,0 @@ -extend schema - @link(url: "https://specs.apollo.dev/federation/v2.11") - @link( - url: "https://specs.apollo.dev/connect/v0.2" - import: ["@source", "@connect"] - ) - -type Query { - products: [Product] - @connect(http: { GET: "http://localhost:4001/products" }, selection: "id") -} - -type Product - @connect( - http: { GET: "http://localhost:4001/products", body: "ids: $batch.id" } - selection: "id" - ) { - id: ID! -} diff --git a/apollo-router/Cargo.toml b/apollo-router/Cargo.toml index 8c7e309088..8450d7f2fc 100644 --- a/apollo-router/Cargo.toml +++ b/apollo-router/Cargo.toml @@ -58,7 +58,7 @@ snapshot = ["axum-server", "serde_regex"] [dependencies] anyhow = "1.0.86" apollo-compiler.workspace = true -apollo-federation = { path = "../apollo-federation", version = "=2.2.0", features = ["connect_v0.2"] } +apollo-federation = { path = "../apollo-federation", version = "=2.2.0" } async-compression = { version = "0.4.6", features = [ "tokio", "brotli",