Replies: 1 comment
-
I'm actually going to close this for now. I just tried on another example without pothos and got the same result. So I must be using federation incorrectly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I created a public repo to highlight the issue I'm having https://github.com/Rtwena/pothos-federation-example
I'm struggling to get a parent resolved entity of
cart
when trying to resolveCart.canCheckout
which uses the@requires
directive. At this point of the codecart
only contains{ id: string, lineItemsStock: LineItemStock[] }
. However, I expect it to contain the resolvedcart
query from it's own service, as well as{ lineItemsStock: LineItemStock[] }
from the stock service.Specifically the data that
canCheckout
requires that is missing is thecart.lineItems
, which is resolved by the cart service. I cannot addlineItems
to the@requires
directive, because then I would need to makelineItems
@external
, which would be invalid schema.The flow of data should be as follows when querying for
Cart
Expected:
query Cart
, returnscart
data includinglineItems
Cart.lineItemsStock
, usinglineItems
from the cart service. returnslineItemsStock
dataCart.canCheckout
, usinglineItemsStock
from the stock service, as well as parentcart
data from the initial query resolverActual:
At step 3, the parent
cart
data is missing, the resolver does not have access tocart.lineItems
. It only has{ id: string, lineItemsStock: LineItemStock[] }
This flow does work when not using pothos to generate the resolvers and using the exact same graphql schema.
For context, I'm working on converting an existing federated graph to pothos.
Beta Was this translation helpful? Give feedback.
All reactions