federation icon indicating copy to clipboard operation
federation copied to clipboard

Ensure that completely overridden type does not generate a join type

Open clenfest opened this issue 4 years ago • 0 comments

I'm a little bit bothered that we have a @join__type for SUBGRAPH2 here given the @override on the type. I do get why, and that @override is supposed to mostly mean "override on all of the fields", but in terms of the supergraph and join spec, this kind of mean that type T is in SUBGRAPH2 but has no fields there. In fact, I was initially surprised that this didn't trigger errors, and the reason it doesn't is that this loop is not guarded by isFed1, but it could have been because before this PR, this logic should never kick in for a fed2 generated supergraph. Put another way, fed2 so far output precise information regarding where things are defined and don't need that kind of cleanup. And it bother me to steer away from this kind of property moving forward, as it makes it a bit harder to work with the supergraph.

To clarify, I agree this isn't a major concern because "it works currently" but I'd feel a tad better if we weren't generating the join__type in that case.

Though to be fair, we need to be careful with graphQL type extensions for this (see my other comment on the subject of type extensions).

Originally posted by @pcmanus in https://github.com/apollographql/federation/pull/1484#r819478201

clenfest avatar Mar 07 '22 17:03 clenfest