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

do not remove __typename from input values #919

Merged
merged 4 commits into from
Apr 26, 2022
Merged

Conversation

Geal
Copy link
Contributor

@Geal Geal commented Apr 26, 2022

Fix #899

For now, there's only a unit test reproducing the issue

@netlify
Copy link

netlify bot commented Apr 26, 2022

Deploy Preview for apollo-router-docs canceled.

Name Link
🔨 Latest commit 85be9fe
🔍 Latest deploy log https://app.netlify.com/sites/apollo-router-docs/deploys/6267fa068994d600080b50a4

@Geal Geal self-assigned this Apr 26, 2022
@github-actions

This comment has been minimized.

@Geal Geal marked this pull request as draft April 26, 2022 10:05
@Geal Geal changed the title add test reproducing the bug Union member data is lost if __typename is requested Apr 26, 2022
Geoffroy Couprie added 2 commits April 26, 2022 14:57
to avoid copies, response formatting removes element from the input
value to add them to the output value. In the case of __typename though,
if it is explicitely requested by the client, it should not be removed
because it might be used in a fragment later.

Example:

query  {
  get {
    __typename
    ... on Product {
      symbol
    }
  }
}

if __typename is removed from input values, it won't be usable in the
fragment spread to check that the type is Product
@Geal Geal changed the title Union member data is lost if __typename is requested do not remove __typename from input values Apr 26, 2022
@Geal Geal requested a review from bnjjj April 26, 2022 13:00
@Geal Geal requested a review from garypen April 26, 2022 14:00
@Geal Geal marked this pull request as ready for review April 26, 2022 15:50
@Geal Geal merged commit 86e7796 into main Apr 26, 2022
@Geal Geal deleted the geal/union-with__typename branch April 26, 2022 16:37
@BrynCooke BrynCooke added this to the v0.1.0-preview.7 milestone May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Union member data is lost if __typename is requested
3 participants