Skip to content
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

Merged
merged 1 commit into from
Jun 29, 2022

Commits on Jun 28, 2022

  1. Fix issue when using a type condition on an inaccessible type in @req…

    …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
    Sylvain Lebresne committed Jun 28, 2022
    Configuration menu
    Copy the full SHA
    b3f0d80 View commit details
    Browse the repository at this point in the history