Skip to content

Commit b1d0eb4

Browse files
committed
Renamed SingleCompositionError to just CompositionError
1 parent 4a84d1e commit b1d0eb4

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

apollo-federation/src/composition/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod satisfiability;
33
use std::vec;
44

55
pub use crate::composition::satisfiability::validate_satisfiability;
6-
use crate::error::SingleCompositionError;
6+
use crate::error::CompositionError;
77
pub use crate::schema::schema_upgrader::upgrade_subgraphs_if_necessary;
88
use crate::subgraph::typestate::Expanded;
99
use crate::subgraph::typestate::Initial;
@@ -16,7 +16,7 @@ pub use crate::supergraph::Supergraph;
1616

1717
pub fn compose(
1818
subgraphs: Vec<Subgraph<Initial>>,
19-
) -> Result<Supergraph<Satisfiable>, Vec<SingleCompositionError>> {
19+
) -> Result<Supergraph<Satisfiable>, Vec<CompositionError>> {
2020
let expanded_subgraphs = expand_subgraphs(subgraphs)?;
2121
let upgraded_subgraphs = upgrade_subgraphs_if_necessary(expanded_subgraphs)?;
2222
let validated_subgraphs = validate_subgraphs(upgraded_subgraphs)?;
@@ -31,8 +31,8 @@ pub fn compose(
3131
/// `@link`). This function will update subgraph schemas with all missing federation definitions.
3232
pub fn expand_subgraphs(
3333
subgraphs: Vec<Subgraph<Initial>>,
34-
) -> Result<Vec<Subgraph<Expanded>>, Vec<SingleCompositionError>> {
35-
let mut errors: Vec<SingleCompositionError> = vec![];
34+
) -> Result<Vec<Subgraph<Expanded>>, Vec<CompositionError>> {
35+
let mut errors: Vec<CompositionError> = vec![];
3636
let expanded: Vec<Subgraph<Expanded>> = subgraphs
3737
.into_iter()
3838
.map(|s| s.expand_links())
@@ -49,8 +49,8 @@ pub fn expand_subgraphs(
4949
/// `@key` specifies valid `FieldSet`s etc).
5050
pub fn validate_subgraphs(
5151
subgraphs: Vec<Subgraph<Upgraded>>,
52-
) -> Result<Vec<Subgraph<Validated>>, Vec<SingleCompositionError>> {
53-
let mut errors: Vec<SingleCompositionError> = vec![];
52+
) -> Result<Vec<Subgraph<Validated>>, Vec<CompositionError>> {
53+
let mut errors: Vec<CompositionError> = vec![];
5454
let validated: Vec<Subgraph<Validated>> = subgraphs
5555
.into_iter()
5656
.map(|s| s.validate())
@@ -66,18 +66,18 @@ pub fn validate_subgraphs(
6666
/// Perform validations that require information about all available subgraphs.
6767
pub fn pre_merge_validations(
6868
_subgraphs: &[Subgraph<Validated>],
69-
) -> Result<(), Vec<SingleCompositionError>> {
69+
) -> Result<(), Vec<CompositionError>> {
7070
panic!("pre_merge_validations is not implemented yet")
7171
}
7272

7373
pub fn merge_subgraphs(
7474
_subgraphs: Vec<Subgraph<Validated>>,
75-
) -> Result<Supergraph<Merged>, Vec<SingleCompositionError>> {
75+
) -> Result<Supergraph<Merged>, Vec<CompositionError>> {
7676
panic!("merge_subgraphs is not implemented yet")
7777
}
7878

7979
pub fn post_merge_validations(
8080
_supergraph: &Supergraph<Merged>,
81-
) -> Result<(), Vec<SingleCompositionError>> {
81+
) -> Result<(), Vec<CompositionError>> {
8282
panic!("post_merge_validations is not implemented yet")
8383
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
mod satisfiability_error;
22

3-
use crate::error::SingleCompositionError;
3+
use crate::error::CompositionError;
44
use crate::supergraph::Merged;
55
use crate::supergraph::Satisfiable;
66
use crate::supergraph::Supergraph;
77

88
pub fn validate_satisfiability(
99
_supergraph: Supergraph<Merged>,
10-
) -> Result<Supergraph<Satisfiable>, Vec<SingleCompositionError>> {
10+
) -> Result<Supergraph<Satisfiable>, Vec<CompositionError>> {
1111
panic!("validate_satisfiability is not implemented yet")
1212
}

apollo-federation/src/error/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub enum UnsupportedFeatureKind {
116116
}
117117

118118
#[derive(Debug, Clone, thiserror::Error)]
119-
pub enum SingleCompositionError {
119+
pub enum CompositionError {
120120
#[error("[{subgraph}] {error}")]
121121
SubgraphError {
122122
subgraph: String,
@@ -140,7 +140,7 @@ pub enum SingleCompositionError {
140140
InterfaceObjectUsageError { message: String },
141141
}
142142

143-
impl From<SubgraphError> for SingleCompositionError {
143+
impl From<SubgraphError> for CompositionError {
144144
fn from(SubgraphError { subgraph, error }: SubgraphError) -> Self {
145145
Self::SubgraphError { subgraph, error }
146146
}

apollo-federation/src/schema/schema_upgrader.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use super::position::InterfaceTypeDefinitionPosition;
2121
use super::position::ObjectTypeDefinitionPosition;
2222
use crate::error::FederationError;
2323
use crate::error::MultipleFederationErrors;
24-
use crate::error::SingleCompositionError;
24+
use crate::error::CompositionError;
2525
use crate::error::SingleFederationError;
2626
use crate::internal_error;
2727
use crate::link::federation_spec_definition::FederationSpecDefinition;
@@ -955,7 +955,7 @@ impl SchemaUpgrader {
955955
// However, those messages were never used, so we have omitted them here.
956956
pub fn upgrade_subgraphs_if_necessary(
957957
subgraphs: Vec<Subgraph<Expanded>>,
958-
) -> Result<Vec<Subgraph<Upgraded>>, Vec<SingleCompositionError>> {
958+
) -> Result<Vec<Subgraph<Upgraded>>, Vec<CompositionError>> {
959959
// if all subgraphs are fed 2, there is no upgrade to be done
960960
if subgraphs
961961
.iter()
@@ -966,7 +966,7 @@ pub fn upgrade_subgraphs_if_necessary(
966966

967967
let mut subgraphs_using_interface_object = vec![];
968968
let mut fed_1_subgraphs = vec![];
969-
let mut errors: Vec<SingleCompositionError> = vec![];
969+
let mut errors: Vec<CompositionError> = vec![];
970970
let schema_upgrader: SchemaUpgrader = SchemaUpgrader::new(&subgraphs);
971971
let upgraded_subgraphs: Vec<Subgraph<Upgraded>> = subgraphs
972972
.into_iter()
@@ -1007,7 +1007,7 @@ pub fn upgrade_subgraphs_if_necessary(
10071007

10081008
let interface_object_subgraphs = format_subgraph_names(subgraphs_using_interface_object);
10091009
let fed_v1_subgraphs = format_subgraph_names(fed_1_subgraphs);
1010-
return Err(vec![SingleCompositionError::InterfaceObjectUsageError {
1010+
return Err(vec![CompositionError::InterfaceObjectUsageError {
10111011
message: format!(
10121012
"The @interfaceObject directive can only be used if all subgraphs have \
10131013
federation 2 subgraph schema (schema with a `@link` to \"https://specs.apollo.dev/federation\" \

0 commit comments

Comments
 (0)