federation
federation copied to clipboard
Type with no fields
Issue Description
If a subgraph has a single field that is overridden, when we run extractSubgraphFromSupergraph it will create a type with no fields which causes a problem. I think the right thing is to just put the field back if there is an overridden field.
Link to Reproduction
n/a
Reproduction Steps
No response
I had an idea to just go ahead and add the fields back in if they had been overridden, which shouldn't be a big deal, but there's a couple of problems.
- Just because there is a reference to an overridden field doesn't mean that the field actually existed. It could have been removed, but the
@overridestill exists in the other subgraph. It's not possible to know whether it existed in the original subgraph or not, so@overridefails reversibility. - I had a thought to just add it to the type if it exists, and ignore it otherwise. The problem with this approach is that we are going to generate query plans and then validate them against the original graphql subgraph schema. So a query that passes against the supergraph might fail against a subgraph if we've post facto injected a field.