-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
error when a non-federated graph is about to be overwritten by a subg…
…raph
- Loading branch information
Showing
6 changed files
with
97 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
query IsFederatedGraph($graphId: ID!, $graphVariant: String!) { | ||
service(id: $graphId) { | ||
implementingServices(graphVariant: $graphVariant) { | ||
__typename | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// PublishPartialSchemaMutation | ||
use crate::blocking::StudioClient; | ||
use crate::RoverClientError; | ||
use graphql_client::*; | ||
|
||
#[derive(GraphQLQuery)] | ||
// The paths are relative to the directory where your `Cargo.toml` is located. | ||
// Both json and the GraphQL schema language are supported as sources for the schema | ||
#[graphql( | ||
query_path = "src/query/config/is_federated.graphql", | ||
schema_path = ".schema/schema.graphql", | ||
response_derives = "PartialEq, Debug, Serialize, Deserialize", | ||
deprecated = "warn" | ||
)] | ||
/// This struct is used to generate the module containing `Variables` and | ||
/// `ResponseData` structs. | ||
/// Snake case of this name is the mod name. i.e. publish_partial_schema_mutation | ||
pub struct IsFederatedGraph; | ||
|
||
#[derive(Debug, PartialEq)] | ||
pub struct IsFederatedGraphResponse { | ||
pub result: bool, | ||
} | ||
|
||
pub fn run( | ||
variables: is_federated_graph::Variables, | ||
client: &StudioClient, | ||
) -> Result<IsFederatedGraphResponse, RoverClientError> { | ||
let data = client.post::<IsFederatedGraph>(variables)?; | ||
let is_federated_response = data.service.unwrap(); | ||
Ok(build_response(is_federated_response)) | ||
} | ||
|
||
type FederatedResponse = is_federated_graph::IsFederatedGraphService; | ||
type ImplementingServices = is_federated_graph::IsFederatedGraphServiceImplementingServices; | ||
|
||
fn build_response(service: FederatedResponse) -> IsFederatedGraphResponse { | ||
match service.implementing_services { | ||
Some(typename) => match typename { | ||
ImplementingServices::FederatedImplementingServices => { | ||
IsFederatedGraphResponse { result: true } | ||
} | ||
ImplementingServices::NonFederatedImplementingService => { | ||
IsFederatedGraphResponse { result: false } | ||
} | ||
}, | ||
None => IsFederatedGraphResponse { result: false }, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/// runner for rover config whoami | ||
pub mod whoami; | ||
|
||
/// runner is_federated check | ||
pub mod is_federated; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,6 @@ | |
"console.table": "^0.10.0" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^2.2.1" | ||
"prettier": "^2.3.0" | ||
} | ||
} |
Oops, something went wrong.