Skip to content

Commit 201efcc

Browse files
Update to apollo-federation 2.0.0-preview.3 (#600)
Co-authored-by: Dylan Anthony <[email protected]>
1 parent 6d822b3 commit 201efcc

File tree

4 files changed

+43
-62
lines changed

4 files changed

+43
-62
lines changed

Cargo.lock

+36-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apollo-composition/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.1.6
4+
- Update to `apollo-federation` 2.0.0-preview.3
5+
36
## 0.1.5
47

58
- [#590](https://github.com/apollographql/federation-rs/pull/590) Fix

apollo-composition/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "apollo-composition"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
license = "Elastic-2.0"
55
edition = "2021"
66
authors = ["Apollo Developers <[email protected]>"]
@@ -10,6 +10,6 @@ repository = "https://github.com/apollographql/federation-rs/"
1010

1111
[dependencies]
1212
apollo-compiler = "1.0.0-beta.24"
13-
apollo-federation = "2.0.0-preview.1"
13+
apollo-federation = "2.0.0-preview.3"
1414
apollo-federation-types = { version = "0.15.0", path = "../apollo-federation-types" }
1515
either = "1.12.0"

apollo-composition/src/lib.rs

+2-48
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use apollo_compiler::parser::LineColumn;
22
use apollo_federation::sources::connect::expand::{expand_connectors, Connectors, ExpansionResult};
3-
use apollo_federation::sources::connect::validation::{
4-
validate, Code, Severity as ValidationSeverity,
5-
};
3+
use apollo_federation::sources::connect::validation::{validate, Severity as ValidationSeverity};
64
use apollo_federation_types::build_plugin::{
75
BuildMessage, BuildMessageLevel, BuildMessageLocation, BuildMessagePoint,
86
};
@@ -73,7 +71,7 @@ pub trait HybridComposition {
7371
validate(&subgraph.sdl, &subgraph.name)
7472
.into_iter()
7573
.map(|validation_error| Issue {
76-
code: transform_code(validation_error.code),
74+
code: validation_error.code.to_string(),
7775
message: validation_error.message,
7876
locations: validation_error
7977
.locations
@@ -184,50 +182,6 @@ pub enum Severity {
184182
Warning,
185183
}
186184

187-
fn transform_code(code: Code) -> String {
188-
match code {
189-
Code::GraphQLError => "GRAPHQL_ERROR",
190-
Code::DuplicateSourceName => "DUPLICATE_SOURCE_NAME",
191-
Code::InvalidSourceName => "INVALID_SOURCE_NAME",
192-
Code::EmptySourceName => "EMPTY_SOURCE_NAME",
193-
Code::InvalidUrlScheme => "INVALID_URL_SCHEME",
194-
Code::SourceNameMismatch => "SOURCE_NAME_MISMATCH",
195-
Code::SubscriptionInConnectors => "SUBSCRIPTION_IN_CONNECTORS",
196-
Code::InvalidUrl => "INVALID_URL",
197-
Code::QueryFieldMissingConnect => "QUERY_FIELD_MISSING_CONNECT",
198-
Code::AbsoluteConnectUrlWithSource => "ABSOLUTE_CONNECT_URL_WITH_SOURCE",
199-
Code::RelativeConnectUrlWithoutSource => "RELATIVE_CONNECT_URL_WITHOUT_SOURCE",
200-
Code::NoSourcesDefined => "NO_SOURCES_DEFINED",
201-
Code::NoSourceImport => "NO_SOURCE_IMPORT",
202-
Code::MultipleHttpMethods => "MULTIPLE_HTTP_METHODS",
203-
Code::MissingHttpMethod => "MISSING_HTTP_METHOD",
204-
Code::EntityNotOnRootQuery => "ENTITY_NOT_ON_ROOT_QUERY",
205-
Code::EntityResolverArgumentMismatch => "ENTITY_RESOLVER_ARGUMENT_MISMATCH",
206-
Code::EntityTypeInvalid => "ENTITY_TYPE_INVALID",
207-
Code::InvalidJsonSelection => "INVALID_JSON_SELECTION",
208-
Code::CircularReference => "CIRCULAR_REFERENCE",
209-
Code::SelectedFieldNotFound => "SELECTED_FIELD_NOT_FOUND",
210-
Code::GroupSelectionIsNotObject => "GROUP_SELECTION_IS_NOT_OBJECT",
211-
Code::InvalidHttpHeaderName => "INVALID_HTTP_HEADER_NAME",
212-
Code::InvalidHttpHeaderValue => "INVALID_HTTP_HEADER_VALUE",
213-
Code::InvalidHttpHeaderMapping => "INVALID_HTTP_HEADER_MAPPING",
214-
Code::UnsupportedFederationDirective => "CONNECTORS_UNSUPPORTED_FEDERATION_DIRECTIVE",
215-
Code::HttpHeaderNameCollision => "HTTP_HEADER_NAME_COLLISION",
216-
Code::UnsupportedAbstractType => "CONNECTORS_UNSUPPORTED_ABSTRACT_TYPE",
217-
Code::MutationFieldMissingConnect => "MUTATION_FIELD_MISSING_CONNECT",
218-
Code::MissingHeaderSource => "MISSING_HEADER_SOURCE",
219-
Code::GroupSelectionRequiredForObject => "GROUP_SELECTION_REQUIRED_FOR_OBJECT",
220-
Code::UnresolvedField => "CONNECTORS_UNRESOLVED_FIELD",
221-
Code::FieldWithArguments => "CONNECTORS_FIELD_WITH_ARGUMENTS",
222-
Code::InvalidStarSelection => "INVALID_STAR_SELECTION",
223-
Code::UndefinedArgument => "UNDEFINED_ARGUMENT",
224-
Code::UndefinedField => "UNDEFINED_FIELD",
225-
Code::UnsupportedVariableType => "UNSUPPORTED_VARIABLE_TYPE",
226-
Code::NullablePathVariable => "NULLABLE_PATH_VARIABLE",
227-
}
228-
.to_string()
229-
}
230-
231185
impl From<ValidationSeverity> for Severity {
232186
fn from(severity: ValidationSeverity) -> Self {
233187
match severity {

0 commit comments

Comments
 (0)