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

Fragment Arguments: Spec Implementation #1010

Closed
wants to merge 1 commit into from

Conversation

mjmahone
Copy link
Contributor

@mjmahone mjmahone commented Jan 19, 2023

This fully specifies the Fragment Arguments changes required, as evidenced by the implementation changes made to graphql-js in graphql/graphql-js#3835

This 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

@netlify
Copy link

netlify bot commented Jan 19, 2023

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit bcca1ba
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/63c9944f82953d000835ce3c
😎 Deploy Preview https://deploy-preview-1010--graphql-spec-draft.netlify.app/draft
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Comment on lines +520 to +525
- 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}.
Copy link
Member

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?

Suggested change
- 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}.

Comment on lines +529 to +532
- Let {fragmentWithArgumentSubstitutions} be the result of calling
{SubstituteFragmentArguments(fragment, arguments)}.
- Let {fragmentSelectionSet} be the top-level selection set of
{fragmentWithArgumentSubstitutions}.
Copy link
Member

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):
Copy link
Member

@JoviDeCroock JoviDeCroock Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoviDeCroock
Copy link
Member

Amendments from my implementation are in mjmahone#3

@mjmahone
Copy link
Contributor Author

mjmahone commented Jun 6, 2024

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).

@mjmahone mjmahone closed this Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Proposal (RFC 1) RFC Stage 1 (See CONTRIBUTING.md)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants