Skip to content

Commit

Permalink
ROVER-245 Fix two small buglets
Browse files Browse the repository at this point in the history
The first is that we weren't supplying the correct content root
for the supergraph.yaml. The second is that we need to have a
value of the routing URLm, even if it's not used, when it goes to the
supergraph.yaml
  • Loading branch information
jonathanrainer committed Nov 24, 2024
1 parent a8a2099 commit 9d740fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/command/lsp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ async fn run_lsp(client_config: StudioClientConfig, lsp_opts: LspOpts) -> RoverR
}
})
.ok_or_else(|| anyhow!("Could not find supergraph.yaml file."))?;
let supergraph_content_root = supergraph_yaml_path.parent().unwrap().to_path_buf();

let studio_client = client_config.get_authenticated_client(&lsp_opts.plugin_opts.profile)?;

Expand All @@ -90,18 +91,13 @@ async fn run_lsp(client_config: StudioClientConfig, lsp_opts: LspOpts) -> RoverR
Some(&FileDescriptorType::File(supergraph_yaml_path.clone())),
)?;
let lazily_resolved_supergraph_config = supergraph_config
.lazily_resolve_subgraphs(&supergraph_yaml_path)
.lazily_resolve_subgraphs(&supergraph_content_root)
.await?;

let root_uri = supergraph_yaml_path
.parent()
.map(|path| path.to_string())
.unwrap_or_default();

// Build the service to spin up the language server
let (service, socket, _receiver) = ApolloLanguageServer::build_service(
Config {
root_uri,
root_uri: supergraph_content_root.to_string(),
enable_auto_composition: false,
force_federation: false,
disable_telemetry: false,
Expand Down
5 changes: 4 additions & 1 deletion src/composition/supergraph/config/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ impl From<FullyResolvedSubgraphs> for SupergraphConfig {
(
name,
SubgraphConfig {
routing_url: None,
// This value is effectively unused but has to be set to something that
// is not "null" when serialised otherwise the supergraph binary
// complains
routing_url: Some(String::from("localhost")),
schema: SchemaSource::Sdl { sdl },
},
)
Expand Down
3 changes: 3 additions & 0 deletions src/composition/supergraph/config/resolve/subgraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub enum ResolveSubgraphError {
supergraph_config_path: Utf8PathBuf,
/// Supplied path to the subgraph schema file
path: PathBuf,
/// The result of joining the paths together, that caused the failure
joined_path: PathBuf,
/// The source error
source: std::io::Error,
},
Expand Down Expand Up @@ -97,6 +99,7 @@ impl UnresolvedSubgraph {
subgraph_name: self.name.to_string(),
supergraph_config_path: root.clone(),
path: path.as_std_path().to_path_buf(),
joined_path: joined_path.as_std_path().to_path_buf(),
source: err,
}),
}
Expand Down

0 comments on commit 9d740fa

Please sign in to comment.