From 201efcc577f284da128cde2412e2cd8dc295e790 Mon Sep 17 00:00:00 2001 From: Matthew Hawkins Date: Mon, 9 Dec 2024 15:45:29 -0700 Subject: [PATCH] Update to apollo-federation 2.0.0-preview.3 (#600) Co-authored-by: Dylan Anthony --- Cargo.lock | 48 +++++++++++++++++++++++-------- apollo-composition/CHANGELOG.md | 3 ++ apollo-composition/Cargo.toml | 4 +-- apollo-composition/src/lib.rs | 50 ++------------------------------- 4 files changed, 43 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4b6ee3cff..cc44d8170 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,6 +39,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "anes" version = "0.1.6" @@ -78,7 +84,7 @@ dependencies = [ [[package]] name = "apollo-composition" -version = "0.1.5" +version = "0.1.6" dependencies = [ "apollo-compiler", "apollo-federation", @@ -88,13 +94,14 @@ dependencies = [ [[package]] name = "apollo-federation" -version = "2.0.0-preview.1" +version = "2.0.0-preview.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c87a5a622646520e2e7df15ed33de1558e9d6eaaa7834eeafd02a8378cd73d2" +checksum = "e5b55660f21b078f44ff3cf3b149c6ea2fa94d7ea698e36caa3729d131c836d1" dependencies = [ "apollo-compiler", "derive_more", "either", + "hashbrown 0.15.2", "http", "indexmap 2.2.6", "itertools 0.13.0", @@ -822,6 +829,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -1013,6 +1026,17 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + [[package]] name = "hdrhistogram" version = "7.5.2" @@ -1789,14 +1813,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.9", + "regex-syntax 0.8.5", ] [[package]] @@ -1810,13 +1834,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -1827,9 +1851,9 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[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 = "relative-path" diff --git a/apollo-composition/CHANGELOG.md b/apollo-composition/CHANGELOG.md index fdd4247e3..cb1ffa35a 100644 --- a/apollo-composition/CHANGELOG.md +++ b/apollo-composition/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.1.6 +- Update to `apollo-federation` 2.0.0-preview.3 + ## 0.1.5 - [#590](https://github.com/apollographql/federation-rs/pull/590) Fix diff --git a/apollo-composition/Cargo.toml b/apollo-composition/Cargo.toml index 2caab8e1a..56e67edd2 100644 --- a/apollo-composition/Cargo.toml +++ b/apollo-composition/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apollo-composition" -version = "0.1.5" +version = "0.1.6" license = "Elastic-2.0" edition = "2021" authors = ["Apollo Developers "] @@ -10,6 +10,6 @@ repository = "https://github.com/apollographql/federation-rs/" [dependencies] apollo-compiler = "1.0.0-beta.24" -apollo-federation = "2.0.0-preview.1" +apollo-federation = "2.0.0-preview.3" apollo-federation-types = { version = "0.15.0", path = "../apollo-federation-types" } either = "1.12.0" diff --git a/apollo-composition/src/lib.rs b/apollo-composition/src/lib.rs index b82073917..e815d80b8 100644 --- a/apollo-composition/src/lib.rs +++ b/apollo-composition/src/lib.rs @@ -1,8 +1,6 @@ use apollo_compiler::parser::LineColumn; use apollo_federation::sources::connect::expand::{expand_connectors, Connectors, ExpansionResult}; -use apollo_federation::sources::connect::validation::{ - validate, Code, Severity as ValidationSeverity, -}; +use apollo_federation::sources::connect::validation::{validate, Severity as ValidationSeverity}; use apollo_federation_types::build_plugin::{ BuildMessage, BuildMessageLevel, BuildMessageLocation, BuildMessagePoint, }; @@ -73,7 +71,7 @@ pub trait HybridComposition { validate(&subgraph.sdl, &subgraph.name) .into_iter() .map(|validation_error| Issue { - code: transform_code(validation_error.code), + code: validation_error.code.to_string(), message: validation_error.message, locations: validation_error .locations @@ -184,50 +182,6 @@ pub enum Severity { Warning, } -fn transform_code(code: Code) -> String { - match code { - Code::GraphQLError => "GRAPHQL_ERROR", - Code::DuplicateSourceName => "DUPLICATE_SOURCE_NAME", - Code::InvalidSourceName => "INVALID_SOURCE_NAME", - Code::EmptySourceName => "EMPTY_SOURCE_NAME", - Code::InvalidUrlScheme => "INVALID_URL_SCHEME", - Code::SourceNameMismatch => "SOURCE_NAME_MISMATCH", - Code::SubscriptionInConnectors => "SUBSCRIPTION_IN_CONNECTORS", - Code::InvalidUrl => "INVALID_URL", - Code::QueryFieldMissingConnect => "QUERY_FIELD_MISSING_CONNECT", - Code::AbsoluteConnectUrlWithSource => "ABSOLUTE_CONNECT_URL_WITH_SOURCE", - Code::RelativeConnectUrlWithoutSource => "RELATIVE_CONNECT_URL_WITHOUT_SOURCE", - Code::NoSourcesDefined => "NO_SOURCES_DEFINED", - Code::NoSourceImport => "NO_SOURCE_IMPORT", - Code::MultipleHttpMethods => "MULTIPLE_HTTP_METHODS", - Code::MissingHttpMethod => "MISSING_HTTP_METHOD", - Code::EntityNotOnRootQuery => "ENTITY_NOT_ON_ROOT_QUERY", - Code::EntityResolverArgumentMismatch => "ENTITY_RESOLVER_ARGUMENT_MISMATCH", - Code::EntityTypeInvalid => "ENTITY_TYPE_INVALID", - Code::InvalidJsonSelection => "INVALID_JSON_SELECTION", - Code::CircularReference => "CIRCULAR_REFERENCE", - Code::SelectedFieldNotFound => "SELECTED_FIELD_NOT_FOUND", - Code::GroupSelectionIsNotObject => "GROUP_SELECTION_IS_NOT_OBJECT", - Code::InvalidHttpHeaderName => "INVALID_HTTP_HEADER_NAME", - Code::InvalidHttpHeaderValue => "INVALID_HTTP_HEADER_VALUE", - Code::InvalidHttpHeaderMapping => "INVALID_HTTP_HEADER_MAPPING", - Code::UnsupportedFederationDirective => "CONNECTORS_UNSUPPORTED_FEDERATION_DIRECTIVE", - Code::HttpHeaderNameCollision => "HTTP_HEADER_NAME_COLLISION", - Code::UnsupportedAbstractType => "CONNECTORS_UNSUPPORTED_ABSTRACT_TYPE", - Code::MutationFieldMissingConnect => "MUTATION_FIELD_MISSING_CONNECT", - Code::MissingHeaderSource => "MISSING_HEADER_SOURCE", - Code::GroupSelectionRequiredForObject => "GROUP_SELECTION_REQUIRED_FOR_OBJECT", - Code::UnresolvedField => "CONNECTORS_UNRESOLVED_FIELD", - Code::FieldWithArguments => "CONNECTORS_FIELD_WITH_ARGUMENTS", - Code::InvalidStarSelection => "INVALID_STAR_SELECTION", - Code::UndefinedArgument => "UNDEFINED_ARGUMENT", - Code::UndefinedField => "UNDEFINED_FIELD", - Code::UnsupportedVariableType => "UNSUPPORTED_VARIABLE_TYPE", - Code::NullablePathVariable => "NULLABLE_PATH_VARIABLE", - } - .to_string() -} - impl From for Severity { fn from(severity: ValidationSeverity) -> Self { match severity {