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

add spec edits for references #998

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Nov 3, 2022

References (soft aliases?) are an alternative syntax for fragment metafields such as __fulfilled

The goal is to create an easily manageable way of requesting different types of fragment spread signals. Multiple metafields or signals will likely be necessary, as after incremental delivery lands, operation writers might be interested in whether a spread has been collected, which can be signaled immediately, or whether all of its fields have been delivered, which may happen only later if the spread has been deferred.

references collect all of these potential signals into a single locus within the response ("the reference") and use "selection set"-style syntax to indicate which signals are of interest. For example, after incremental delivery lands, the following might be valid:

query FragmentReferences {
  nodes(ids: [1, 42]) {
    id
    UserFields { selected }: ...userFragment
    SuperUserFields { selected completed}: ...superUserFragment @defer
  }
}

fragment userFragment on User {
  friends {
    count
  }
}

fragment superUserFragment on SuperUser {
  privilegeLevel
}

This would yield the following data right away:

{
  "nodes": [
    {
      "id": 1,
      "UserFields": { "selected": null },
      "friends": { "count": 1234 }
    },
    {
      "id": 42,
      "UserFields": { "selected": null },
      "friends": { "count": 5678 },
      "SuperUserFields": { "selected": null },
    }
  ]
}

And the following additional payload at path nodes.1 when the deferred fields complete:

{
  "SuperUserFields": { "completed": null },
  "privilegeLevel": 20
}

The existing spec edits only describe the "selected" signal. I am working on the completed signal alongside a version of incremental delivery that does not branch execution or duplicate fields.

@netlify
Copy link

netlify bot commented Nov 3, 2022

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit f98ca57
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/636406a1b5af41000897adf6
😎 Deploy Preview https://deploy-preview-998--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 settings.

references are an alternative syntax for fragment metafields such as `__fulfilled`
@benjie benjie added the 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md) label Nov 4, 2022
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Nov 6, 2022
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Nov 6, 2022
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Nov 6, 2022
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Nov 11, 2022
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Jan 13, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Jan 13, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Jan 14, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Jan 15, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
robrichard added a commit to robrichard/graphql-spec that referenced this pull request Mar 17, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)

# Conflicts:
#	spec/Section 6 -- Execution.md
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Mar 20, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
yaacovCR added a commit to yaacovCR/graphql-spec that referenced this pull request Mar 20, 2023
Rather than merging subSelectionSets of a field set using MergeSelectionSets and then calling CollectFields, introducing CollectSubfields allows the field set's groupedSubfieldSet to be calculated directly.

This may be helpful if the specification were ever to be altered such that additional state beyond the current selection set were to be required to calculate the response, i.e. if it were to be required to know the originating selectionSet of a given field within the fieldSet for determining when to communicate a reference signal.

See graphql#998 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants