-
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.
The improvements in #2101 did not quite work in all cases, due to some "enhancements" that the `resolve_supergraph_yaml` (which reads the `--config` file) applies which are overzealous in the case where the YAML file is an "override" to a graph ref. First, `resolve_supergraph_yaml` sets a default `federation_version` (based on whether or not any subgraph SDLs contain the `@link` directive) if one is not provided. The YAML file's federation version correctly takes precedence over a remote `federation_version`, which means it's not appropriate for us to calculate this default if the file lacks a `federation_version` but we have one from another source. This PR adds a parameter to `resolve_supergraph_yaml` which suppresses this defaulting in the case where you have also specified `--graph-ref` and read a federation version from GraphOS (or if you've specified it explicitly on the command line: previously this case "worked" in that the CLI option took precedence, but it would print a warning first telling you to specify the version). Secondly, we want to no longer treat a lack of a `routing_url` for a subgraph in the YAML file as an error, so that the improvement in #2101 which lets you merge local SubgraphConfigs with `routing_url: None` with remote SubgraphConfigs that have routing URLs works. But `resolve_supergraph_yaml` required every subgraph definition to have a routing URL (and in fact used the `SubgraphDefinition` struct as an intermediate data type, which requires the routing URL to exist). We refactor to no longer use that as an intermediate data type so that it's OK for the routing URL to still be None (like it is in the `SupergraphConfig` type that the function returns). (You may wonder if it's safe that the `SupergraphConfig` returned from `resolve_supergraph_yaml` can now have None in its routing URLs when that was not possible before. But it already was the case that a graph read from GraphOS lacked routing URLs; this requirement was only enforced here for local configuration. The lack of a routing URL gets caught later and turned into an error when `Compose::exec` calls `supergraph_config.get_subgraph_definitions()`.)
- Loading branch information
1 parent
489f8df
commit d528b91
Showing
1 changed file
with
151 additions
and
79 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