-
Notifications
You must be signed in to change notification settings - Fork 88
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
Conversation
✅ Docs Preview ReadyNo new or changed pages found. |
There was a problem hiding this 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
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, | ||
} | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@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. |
3198b6a
to
2386d35
Compare
Yer let's do that, just so we're clear what's testing what etc. Happy to approve once that's sorted :) |
e6d6cb8
to
3f916c2
Compare
I extracted the bits of the tests that matter into the federation.rs file, so we should be good to go now. |
3f916c2
to
a878458
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a878458
to
c7844ff
Compare
Extracts federation version resolution in order to be used independently of supergraph config