Skip to content

Commit

Permalink
ROVER-135 Make paths in supergraph.yaml resolve relative to the locat…
Browse files Browse the repository at this point in the history
…ion of the file, not the current working directory of Rover (#2119)

As per the title, to support integration with the Language Server we
need to remove a 'quirk' of Rover whereby if you specify a file in the
supergraph.yaml with a relative path, that path is resolved relative to
the location that rover is running in at the time. This doesn't work in
that context so instead we are changing it to resolve relative to the
location of the supergraph.yaml file itself.

I've added a unit test for this and run my own tests and it all seems to
work ok.

In addition I've fixed a test that has been broken for a long time, a
more detailed write up on this test will follow

Successful smoke test run:
https://github.com/apollographql/rover/actions/runs/10795662532/job/29943305762
  • Loading branch information
jonathanrainer authored Sep 10, 2024
1 parent da93b31 commit 1ed1a27
Show file tree
Hide file tree
Showing 5 changed files with 546 additions and 407 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ apollo-parser = "0.8"
apollo-encoder = "0.8"

# https://github.com/apollographql/federation-rs
apollo-federation-types = "0.13.2"
apollo-federation-types = { git = "https://github.com/apollographql/federation-rs", branch = "jr/ROVER-135" }

# crates.io dependencies
ariadne = "0.4"
Expand Down
20 changes: 13 additions & 7 deletions src/error/metadata/suggestion.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::cmp::Ordering;
use std::fmt::{self, Display, Write as _};

use crate::utils::env::RoverEnvKey;
use camino::Utf8PathBuf;
use rover_client::shared::GraphRef;
use rover_std::Style;

use crate::utils::env::RoverEnvKey;
use std::cmp::Ordering;
use std::fmt::{self, Display, Write as _};

use serde::Serialize;

Expand Down Expand Up @@ -79,6 +78,10 @@ pub enum RoverErrorSuggestion {
frontend_url_root: String,
},
AddRoutingUrlToSupergraphYaml,
InvalidSupergraphYamlSubgraphSchemaPath {
subgraph_name: String,
supergraph_yaml_path: Utf8PathBuf,
},
PublishSubgraphWithRoutingUrl {
subgraph_name: String,
graph_ref: String,
Expand Down Expand Up @@ -256,8 +259,11 @@ UpgradePlan => "Rover has likely reached rate limits while running graph or subg
format!("Try publishing the subgraph with a routing URL like so `rover subgraph publish {graph_ref} --name {subgraph_name} --routing-url <url>`")
},
AllowInvalidRoutingUrlOrSpecifyValidUrl => format!("Try publishing the subgraph with a valid routing URL. If you are sure you want to publish an invalid routing URL, re-run this command with the {} option.", Style::Command.paint("`--allow-invalid-routing-url`")),
ContactApolloAccountManager => {"Discuss your requirements with your Apollo point of contact.".to_string()}
TryAgainLater => {"Please try again later.".to_string()}
ContactApolloAccountManager => {"Discuss your requirements with your Apollo point of contact.".to_string()},
TryAgainLater => {"Please try again later.".to_string()},
InvalidSupergraphYamlSubgraphSchemaPath {
subgraph_name, supergraph_yaml_path
} => format!("Make sure the specified path for subgraph '{}' is relative to the location of the supergraph schema file ({})", subgraph_name, Style::Path.paint(supergraph_yaml_path))
};
write!(formatter, "{}", &suggestion)
}
Expand Down
Loading

0 comments on commit 1ed1a27

Please sign in to comment.