-
Notifications
You must be signed in to change notification settings - Fork 254
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
@inaccessible
object types within fragment-nested @requires
can cause Fed 2 composition to throw
#1863
Comments
That issue is actually fixed by the patch in #1873. More precisely, it's the part of the commit there where I said:
I've pushed the repro of this ticket as a unit test on that #1873 PR for good measure, but I'll close both this and #1866 when than PR lands. |
…uire The `@require(fields:)` argument can use some type conditions to require data specific to a subtype. And those condition can even be on an `@inaccessible` type since "inaccessibility is about the federated API schema, not about subgraphs. However, this wasn't properly working because when the execution code was extracting the "requirements" data to pass it to the subgraph having the `@require`, the (federated) API schema we used, and consequently when the code tried to get the definition for the type condition in the `@require`, it didn't find any definition (since the type in question is `@inaccessible` and so not in said API schema) and as a result the corresponding fields were not included in the subgraph query. This commit fixes this issue, ensuring we pass the full supergraph (which _has_ the `@inaccessible` elements) to the execution code so that supergraph can be used when extracting required data. There was also another place within query planning (in `graphPath.ts` more precisely) where the code was looking up the possible implementation types, in the supergraph, of the required `@inaccessible` type, and was using the supergraph API to do so, which was incorrect for the same reason. This commit fix that problem as well, passing the full supergraph instead. Fixes apollographql#1866, apollographql#1863
…uire (#1873) The `@require(fields:)` argument can use some type conditions to require data specific to a subtype. And those condition can even be on an `@inaccessible` type since "inaccessibility is about the federated API schema, not about subgraphs. However, this wasn't properly working because when the execution code was extracting the "requirements" data to pass it to the subgraph having the `@require`, the (federated) API schema we used, and consequently when the code tried to get the definition for the type condition in the `@require`, it didn't find any definition (since the type in question is `@inaccessible` and so not in said API schema) and as a result the corresponding fields were not included in the subgraph query. This commit fixes this issue, ensuring we pass the full supergraph (which _has_ the `@inaccessible` elements) to the execution code so that supergraph can be used when extracting required data. There was also another place within query planning (in `graphPath.ts` more precisely) where the code was looking up the possible implementation types, in the supergraph, of the required `@inaccessible` type, and was using the supergraph API to do so, which was incorrect for the same reason. This commit fix that problem as well, passing the full supergraph instead. Fixes #1866, #1863
Well, better late than never. |
Description
When an object type is
@inaccessible
and is used in a fragment-nested@requires
, it can cause Fed 2 composition to throw. (To be clear, I'm not sure what the root cause is; it may be something else.)Example
When using
@apollo/composition@2.0.2
, composing the following two subgraphs will causecomposeServices()
to throw.The stacktrace emitted is:
The text was updated successfully, but these errors were encountered: