-
Notifications
You must be signed in to change notification settings - Fork 56
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
Always add __typename to abstract types #91
Conversation
3d74958
to
2c776bd
Compare
@@ -2,4 +2,5 @@ | |||
.vscode | |||
.history | |||
.idea | |||
.DS_Store |
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.
the bane of MacOS developers...
Codecov Report
@@ Coverage Diff @@
## main #91 +/- ##
==========================================
+ Coverage 67.15% 67.17% +0.02%
==========================================
Files 24 24
Lines 2749 2754 +5
==========================================
+ Hits 1846 1850 +4
- Misses 748 749 +1
Partials 155 155
Continue to review full report at Codecov.
|
@nmaquet – this is ready for consideration. |
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.
Another nice find, thanks @gmac.
I'm thinking; if we guarantee a |
@suessflorian — I had the same thought… I haven’t dug deep enough into the execution pipeline yet for the answer though. The wildcard would be if typename is somehow used for looking up fragments within the resolver, at which time a fragment on a concrete type (which is totally valid) would still need typename via the fragment. Leaving the status quo seemed safest. |
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.
Thanks @gmac!
Preemptively fixing the same issue described in #81, but with
__typename
...The (potential) problem
Given that the execution resolver uses
__typename
while assembling abstract types, we need to assure that a typename is always returned. However, the automated__typename
hints are currently only added to user-defined fragments, and those aren't guaranteed to be present when making abstract type selections (case of point: selecting base interface fields).While I haven't actually made this scenario fail, I strongly suspect that it can be broken.
The (preemptive) fix
This adds
__typename
to all abstract types. In the event that the user doesn't make a fragment selection on an abstract, the selection will still request typename for resolution purposes.