Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with @requires using wrong "return key"
Some times, when a @requires is just after a key, we can simply collect the required field before taking the key. Other times, we encounter a @require in a type T of a subgraph A, and have to jump to subgraph B to get the required field. In that case, once we've collected the required fields, we need to "resume" query on T in A, and that means using a key there. The code dealing with that post-require "return key" later case was incorrect, essentially using a key on subgraph B instead of one on subgraph A. As a consequence, subgraphs that shouldn't have been allowed to compose (because they were missing the needed key on A) were allowed to composed, and the code later failed during query planning. This commit fixes this issue, and adds tests for that case. One of the test introduced _fails_ as of this commit, but that is due to the problem describe on apollographql#376 and the fix will be in a followup commit.
- Loading branch information