-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Replace ExecuteSelectionSet
with ExecuteCollectedFields
#1039
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
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
4d62b8b
to
b342b58
Compare
(Rebased on |
b342b58
to
a52310e
Compare
(Rebased on |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@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 |
@leebyron To reflect your discussion above, I've renamed "ExecuteGroupedFieldSet" to "ExecuteCollectedFields" and that definitely flows better. However, I think that "grouped field set" is still the right term to refer to the structure and actually defining a "field set" in general adds a lot of clarity to a number of algorithms (e.g. This makes the algorithms a lot clearer to me: -CollectSubfields(objectType, fields, variableValues):
+CollectSubfields(objectType, fieldSet, variableValues): ^ Knowing that a "field set" is a set of field selections that share the same response key makes this algorithms purpose a lot clearer -ExecuteField(objectType, objectValue, fieldType, fields, variableValues):
+ExecuteField(objectType, objectValue, fieldType, fieldSet, variableValues): ^ A lot more intuitive what -CompleteValue(fieldType, fields, result, variableValues):
+CompleteValue(fieldType, fieldSet, result, variableValues): ^ Same |
c7532d1
to
6e76340
Compare
6e76340
to
3c6dfb3
Compare
spec/Section 6 -- Execution.md
Outdated
:: A _field set_ is a list of selected fields that share the same _response | ||
name_ (the field alias if defined, otherwise the field's name). | ||
|
||
Note: The order of field selections in a _field set_ is significant, hence the | ||
algorithms in this specification model it as a list. Any later duplicated field | ||
selections in a field set will not impact its interpretation, so using an | ||
ordered set would yield equivalent results. |
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.
spec/Section 3 -- Type System.md
Outdated
@@ -757,7 +757,7 @@ type Person { | |||
} | |||
``` | |||
|
|||
Valid operations must supply a nested field set for any field that returns an | |||
Valid operations must supply a selection of fields for any field that returns an |
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.
Not directly related to this PR but a more precise wording would be to use selectionSet
here as fragments are also valid, not only fields.
Valid operations must supply a selection of fields for any field that returns an | |
Valid operations must supply a valid sub _selection set_ for any field that returns an |
1e42cc4
to
d0fb75c
Compare
ed11e66
to
9c4a529
Compare
@benjie I made some substantial editorial changes here, especially to one of the term names. Please review! |
e4a5199
to
c776fa7
Compare
c776fa7
to
97d43ba
Compare
Thanks Lee! Suggested edits raised in #1175 |
* Resolve ambiguity - we mean return type For `type User { name: String }`, `User.name` is a field of an object type (`User`). Clarify that we mean the return type of the field, not the type to which it belongs. * Consistency with collectedFieldsMap * Reword to avoid 'During execution, ... before execution.' * Serial execution relates to the set of fields, not each individual field * Add missing close parenthesis * Remove duplicate 'by', specific algorithm is detailed in next paragraph * CollectFields() produces many _field set_ * Minor edits
Essentially this PR replaces the
ExecuteSelectionSet
method withExecuteCollectedFields
(which essentially just drops the first line ofExecuteSelectionSet
, which was responsible for collecting fields to be executed). It then refactors the rest of the spec to accommodate this change, reducing the repetition inExecuteQuery
,ExecuteMutation
andExecuteSubscriptionEvent
; and removingMergeSelectionSets
(which generated a "virtual" selection set to accomodate theExecuteSelectionSet
method), instead adding aCollectSubfields
algorithm which produces 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 theCollectSubfields
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.