Context: I’m new to Apollo and Apollo federation, and am evaluating it as a potential fit for a project I’m working on. I’m using a simplified example below to describe my issue/question.
I have two GraphQL services, they both provide a Book
resources. The Book
s from both subgraphs have the same shape of the data coming from them as well as the querying options (e.g. queries support the same arguments).
I had hoped (and am holding out hope still :)) that if I used Apollo’s Federation I would “magically” be able to query the supergraph and I’d automatically get back the results from both of my subgraphs. Basically “build a query plan that just queries both subgraphs and combines the results”.
From what I can tell, this does not “just work” - I set up a very simple PoC and from what I can tell if the same “resources” are found across two subgraphs then Federation acts as more of an overlay - if you ask for a field that exists on one service but not another, Apollo federation is smart enough to go fetch the unique field from the second graph and combine the data.
I’m wondering if I’m missing anything, if there is a switch I can set to have federation combine “streams” vs what seems to be more of an overlay, or if not if there is a common pattern for handle this sort of situation? - it’s also possible I’m looking to a solve a problem I have no business handling in the GraphQL / API layer and I need to handle this somewhere lower level.
Thanks for any help / advice, even if it’s just confirming for me that combining the same resources isn’t something federation will do for me.