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

a __typename field at the Query level should receive a matching response #1922

Closed
Geal opened this issue Sep 30, 2022 · 5 comments · Fixed by #2253 or #2274
Closed

a __typename field at the Query level should receive a matching response #1922

Geal opened this issue Sep 30, 2022 · 5 comments · Fixed by #2253 or #2274

Comments

@Geal
Copy link
Contributor

Geal commented Sep 30, 2022

in #1800 (comment), a deferred query is done where the __typename
field is not added in the right response

@abernix
Copy link
Member

abernix commented Oct 20, 2022

@Geal Is #1677 related to this?

@Geal
Copy link
Contributor Author

Geal commented Oct 20, 2022

That's likely yes

@Geal
Copy link
Contributor Author

Geal commented Dec 13, 2022

fixed by #2253

@Geal Geal closed this as completed Dec 13, 2022
@BoD
Copy link

BoD commented Dec 15, 2022

It looks like I still see the issue with 1.6.0 with a query of the form:

query CanDeferFragmentsOnTheTopLevelQueryFieldQuery {
  __typename
  ...FragmentOnQuery @defer
}
fragment FragmentOnQuery on Query {
  computers {
    id
  }
}

Repro steps:

git clone git@github.com:apollographql/apollo-kotlin.git
cd apollo-kotlin
git checkout ed8a6ec9d95697545b6211decb518aa4a8fd6fee
# Install and run the subgraph
(cd tests/defer/router/subgraphs/computers && npm install && APOLLO_PORT=4001 npm start)&
# Run the router
path/to/router --supergraph tests/defer/router/simple-supergraph.graphqls &
# Query
curl --request POST     --header 'content-type: application/json'     --header 'accept: multipart/mixed; deferSpec=20220824, application/json'     --url 'http://127.0.0.1:4000/'     --data '{"query":"query CanDeferFragmentsOnTheTopLevelQueryFieldQuery {\n  __typename\n  ...FragmentOnQuery @defer\n}\n\nfragment FragmentOnQuery on Query {\n  computers {\n    id\n  }\n}"}'

Actual:

--graphql
content-type: application/json

{"data":null,"hasNext":true}
--graphql
content-type: application/json

{"hasNext":false,"incremental":[{"data":{"__typename":"Query","computers":[{"id":"Computer1"},{"id":"Computer2"}]},"path":[]}]}
--graphql--

Expected:

--graphql
content-type: application/json

{"data":{"__typename":"Query"},"hasNext":true}
--graphql
content-type: application/json

{"hasNext":false,"incremental":[{"data":{"computers":[{"id":"Computer1"},{"id":"Computer2"}]},"path":[]}]}
--graphql--

@bnjjj
Copy link
Contributor

bnjjj commented Dec 15, 2022

I'm able to reproduce it, I will investigate

@bnjjj bnjjj reopened this Dec 15, 2022
bnjjj added a commit that referenced this issue Dec 19, 2022
…st response is empty (#2274)

close #1922

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
@abernix abernix added this to the v1.7.0 milestone Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment