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

Replace ExecuteSelectionSet with ExecuteGroupedFieldSet #1039

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

benjie
Copy link
Member

@benjie benjie commented Aug 21, 2023

Essentially this PR raises the concept of "grouped field sets" to be a top-level concept, and replaces the ExecuteSelectionSet method with ExecuteGroupedFieldSet (which essentially just drops the first line of ExecuteSelectionSet, which was responsible for producing the grouped field set to be executed). It then refactors the rest of the spec to accommodate this change, reducing the repetition in ExecuteQuery, ExecuteMutation and ExecuteSubscriptionEvent; and removing MergeSelectionSets (which generated a "virtual" selection set to accomodate the ExecuteSelectionSet method), instead adding a CollectSubfields algorithm which generates a grouped field set directly, ready for execution.

I extracted this common refactoring from a number of my attempts to write spec changes for the @defer and @stream directives - it turns out that this refactoring of the spec was always needed as a base for my changes. Similarly, @yaacovCR found similar in his attempts to address this same problem, and raised #999 extracted from his solution. This PR was introduced independently of #999 (other than using the CollectSubfields algorithm name) however there is significant alignment, so @yaacovCR suggested that I raise it as an alternative PR.

It may be easier to review this PR in "split" view rather than "unified" view.

@netlify
Copy link

netlify bot commented Aug 21, 2023

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit 140c3da
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/67ca156c185d1200085322e8
😎 Deploy Preview https://deploy-preview-1039--graphql-spec-draft.netlify.app
📱 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 configuration.

@benjie
Copy link
Member Author

benjie commented Feb 5, 2024

(Rebased on main)

@benjie benjie force-pushed the benjie/incremental-common branch from b342b58 to a52310e Compare September 19, 2024 11:51
@benjie
Copy link
Member Author

benjie commented Sep 19, 2024

(Rebased on main)

@yaacovCR

This comment was marked as resolved.

@benjie

This comment was marked as resolved.

@yaacovCR

This comment was marked as resolved.

@Keweiqu
Copy link
Contributor

Keweiqu commented Oct 3, 2024

@benjie we need to formally define "grouped field set" in Section 2 "Language". You might have done so in a prior PR that I missed. Here is the link to us defining "section sets" in section 2 https://spec.graphql.org/draft/#sec-Selection-Sets

JoviDeCroock added a commit to JoviDeCroock/graphql-spec that referenced this pull request Feb 15, 2025
@benjie benjie added the ✏️ Editorial PR is non-normative or does not influence implementation label Mar 6, 2025
@benjie
Copy link
Member Author

benjie commented Mar 6, 2025

This is up-to-date and ready-to-go again.

@yaacovCR or @JoviDeCroock; please can you confirm this latest text still aligns with GraphQL.js.

@Keweiqu Since a "grouped field set" is only part of execution and doesn't have an expression in the language I've not defined it in chapter 2, but in chapter 6 instead. (Here's where the current spec first introduces the term: https://spec.graphql.org/draft/#sel-FANRFABAB5EnhJ )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Editorial PR is non-normative or does not influence implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants