Skip to content

Commit

Permalink
Update to apollo-federation 2.0.0-preview.3 (#600)
Browse files Browse the repository at this point in the history
Co-authored-by: Dylan Anthony <[email protected]>
  • Loading branch information
pubmodmatt and dylan-apollo authored Dec 9, 2024
1 parent 6d822b3 commit 201efcc
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 62 deletions.
48 changes: 36 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions apollo-composition/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions apollo-composition/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand All @@ -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"
50 changes: 2 additions & 48 deletions apollo-composition/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<ValidationSeverity> for Severity {
fn from(severity: ValidationSeverity) -> Self {
match severity {
Expand Down

0 comments on commit 201efcc

Please sign in to comment.