-
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
Fix issue when using a type condition on an inaccessible type in @req… #1873
Fix issue when using a type condition on an inaccessible type in @req… #1873
Conversation
👷 Deploy request for apollo-federation-docs pending review.Visit the deploys page to approve it
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
…uire This is the fed1 version of the fed2 patch at apollographql#1873. Seen that PR/commit for more details.
e928e02
to
16787b6
Compare
As mentioned on that ticket, this PR also fixes #1873. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question about how we version this, but the functionality looks good
983cd57
to
6a54f73
Compare
…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
6a54f73
to
b3f0d80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐐
…uire
The
@require(fields:)
argument can use some type conditions to requiredata specific to a subtype. And those condition can even be on an
@inaccessible
type since "inaccessibility is about the federated APIschema, 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 consequentlywhen 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 thecorresponding 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 sothat 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