Skip to content

Commit

Permalink
Add general constructor for SupergraphConfig (#515)
Browse files Browse the repository at this point in the history
This allows us to create a `SupergraphConfig` using the same types as
its internal properties in order to support building this object from
non-serialized sources.
  • Loading branch information
dotdat authored Jun 21, 2024
2 parents c213606 + cf09ce3 commit dd631eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apollo-federation-types/src/config/supergraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ pub struct SupergraphConfig {
}

impl SupergraphConfig {
/// Creates a new SupergraphConfig
pub fn new(
subgraphs: BTreeMap<String, SubgraphConfig>,
federation_version: Option<FederationVersion>,
) -> SupergraphConfig {
SupergraphConfig {
subgraphs,
federation_version,
}
}
/// Create a new SupergraphConfig from a YAML string in memory.
pub fn new_from_yaml(yaml: &str) -> ConfigResult<SupergraphConfig> {
let parsed_config: SupergraphConfig =
Expand Down

0 comments on commit dd631eb

Please sign in to comment.