-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fragment Arguments: Spec Implementation #1010
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
9dbac33
to
bcca1ba
Compare
- Let {arguments} be the set of arguments on {selection}. | ||
- Let {fragmentSpreadKey} be a unique key of {fragmentSpreadName} and | ||
{arguments}. | ||
- If {fragmentSpreadKey} is in {visitedFragments}, continue with the next | ||
{selection} in {selectionSet}. | ||
- Add {fragmentSpreadKey} to {visitedFragments}. |
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.
Judging from graphql/graphql-js#3835 (comment) this isn't needed, or am I misunderstanding that?
- Let {arguments} be the set of arguments on {selection}. | |
- Let {fragmentSpreadKey} be a unique key of {fragmentSpreadName} and | |
{arguments}. | |
- If {fragmentSpreadKey} is in {visitedFragments}, continue with the next | |
{selection} in {selectionSet}. | |
- Add {fragmentSpreadKey} to {visitedFragments}. | |
- If {fragmentSpreadName} is in {visitedFragments}, continue with the next | |
{selection} in {selectionSet}. | |
- Add {fragmentSpreadName} to {visitedFragments}. |
- Let {fragmentWithArgumentSubstitutions} be the result of calling | ||
{SubstituteFragmentArguments(fragment, arguments)}. | ||
- Let {fragmentSelectionSet} be the top-level selection set of | ||
{fragmentWithArgumentSubstitutions}. |
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.
We changed this to create a shadowed copy of variables that is relevant to the fragment-spread we are on
@@ -562,9 +568,36 @@ DoesFragmentTypeApply(objectType, fragmentType): | |||
- if {objectType} is a possible type of {fragmentType}, return {true} | |||
otherwise return {false}. | |||
|
|||
SubstituteFragmentArguments(fragment, arguments): |
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.
We'll need to replace this with getArgumentValuesFromSpread
https://github.com/JoviDeCroock/graphql-js/pull/2/files#diff-777202fe667b9e656f40631c341c7c0776895a75eff7004578bf9b7a97e095abR161
Amendments from my implementation are in mjmahone#3 |
I second Benjie's move that we replace this by #1081, which has substantial improvements (and will make merging easier, when there aren't stacked PRs). |
This fully specifies the Fragment Arguments changes required, as evidenced by the implementation changes made to
graphql-js
in graphql/graphql-js#3835This is an update to a years-old RFC PR #865, but given that PR had a lot of discussion that has been resolved, it should be easier for reviewers to start with this PR as a cleaner slate. I've tried to incorporate all discussion from previous PRs and Working Group discussion into the initial commit here.
Please use this PR for reviewing and verifying the accuracy of the PR, with inline comments when possible.
For discussions about Fragment Arguments as an idea, missing features or open questions, please open or respond to a thread in the graphql-wg discussion space: graphql/graphql-wg#1239