Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract federation version resolution #2289

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

dotdat
Copy link
Contributor

@dotdat dotdat commented Dec 5, 2024

Extracts federation version resolution in order to be used independently of supergraph config

@dotdat dotdat requested a review from a team as a code owner December 5, 2024 23:10
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Dec 5, 2024

✅ Docs Preview Ready

No new or changed pages found.

Copy link
Contributor

@jonathanrainer jonathanrainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, other than the single point. Do we have tests for the resolution somewhere? We might have and they're not changed so not in the PR but good to know they're there if we have them

Comment on lines 70 to 89
pub fn from_supergraph_config(
self,
supergraph_config: &SupergraphConfig,
) -> FederationVersionResolver<state::FromSubgraphs> {
let federation_version = self
.federation_version
.or(supergraph_config.get_federation_version());
FederationVersionResolver {
state: PhantomData::<state::FromSubgraphs>,
federation_version,
}
}

/// Skips [`SupergraphConfig`] resolution, presumably because there is none
pub fn skip_supergraph_resolution(self) -> FederationVersionResolver<state::FromSubgraphs> {
FederationVersionResolver {
state: PhantomData::<state::FromSubgraphs>,
federation_version: self.federation_version,
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better/is there a way to merge this together into a single step, so we take an Option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged these, which I think is more consistent with what we do elsewhere.

@dotdat
Copy link
Contributor Author

dotdat commented Dec 6, 2024

Looks pretty good to me, other than the single point. Do we have tests for the resolution somewhere? We might have and they're not changed so not in the PR but good to know they're there if we have them

@jonathanrainer There are tests are in src/composition/supergraph/config/mod.rs from the original supergraph config resolution code that uses this new path. I could migrate that if it makes it more precise to have it hanging out with the FederationResolver source code.

@dotdat dotdat force-pushed the dotdat/run-router.extract-federation-resolution branch from 3198b6a to 2386d35 Compare December 7, 2024 01:10
@jonathanrainer
Copy link
Contributor

Looks pretty good to me, other than the single point. Do we have tests for the resolution somewhere? We might have and they're not changed so not in the PR but good to know they're there if we have them

@jonathanrainer There are tests are in src/composition/supergraph/config/mod.rs from the original supergraph config resolution code that uses this new path. I could migrate that if it makes it more precise to have it hanging out with the FederationResolver source code.

Yer let's do that, just so we're clear what's testing what etc. Happy to approve once that's sorted :)

@dotdat dotdat force-pushed the dotdat/run-router.extract-federation-resolution branch 2 times, most recently from e6d6cb8 to 3f916c2 Compare December 10, 2024 22:58
@dotdat
Copy link
Contributor Author

dotdat commented Dec 11, 2024

Looks pretty good to me, other than the single point. Do we have tests for the resolution somewhere? We might have and they're not changed so not in the PR but good to know they're there if we have them

@jonathanrainer There are tests are in src/composition/supergraph/config/mod.rs from the original supergraph config resolution code that uses this new path. I could migrate that if it makes it more precise to have it hanging out with the FederationResolver source code.

Yer let's do that, just so we're clear what's testing what etc. Happy to approve once that's sorted :)

I extracted the bits of the tests that matter into the federation.rs file, so we should be good to go now.

@dotdat dotdat force-pushed the dotdat/run-router.extract-federation-resolution branch from 3f916c2 to a878458 Compare December 11, 2024 21:14
Copy link
Contributor

@jonathanrainer jonathanrainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dotdat dotdat force-pushed the dotdat/run-router.extract-federation-resolution branch from a878458 to c7844ff Compare December 12, 2024 15:43
@dotdat dotdat enabled auto-merge (squash) December 12, 2024 15:43
@dotdat dotdat merged commit 09925a1 into main Dec 12, 2024
31 checks passed
@dotdat dotdat deleted the dotdat/run-router.extract-federation-resolution branch December 12, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants