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

Editorial: Define _response payload_ #1149

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

Conversation

robrichard
Copy link
Contributor

Follow up from #1135, Based on top of #1148

Alternative name Response Map: #1143

This creates a definition for Response Payload, defined as the map normally returned by GraphQL queries and mutations containing data and/or errors.

The definition of Response is updated to include both Response Payload, and Response Stream (for subscriptions).

I like using Payload as i think it extends naturally for incremental delivery. If this change is approved I plan to add two additional types, InitialResponsePayload and SubsequentResponsePayload as well as IncrementalStream, the stream of those types.

Proposal for incremental delivery (roughly):

type ResponsePayload = {
  data?: object
  errors?: Error[]
  extensions?: object
}
type ResponseStream = ResponsePayload[]
type IncrementalStream = [InitialResponsePayload, ...SubsequentResponsePayload];
type Response = ResponsePayload | ResponseStream | IncrementalStream;

I went through every mention of response and most of the remaining usages are around response key or response field, referring to the object property name (ie for aliases and error paths). This could also likely be standardized in a follow up. See https://github.com/graphql/graphql-spec/pull/1147/files

Verified

This commit was signed with the committer’s verified signature.
abdurrahman-ledger Abdurrahman Sastim
…et result
Copy link

netlify bot commented Mar 13, 2025

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit bb5766e
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/67d31af2168742000869af98
😎 Deploy Preview https://deploy-preview-1149--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.

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

I approve, I think this makes it a lot clearer.

@robrichard robrichard force-pushed the robrichard/response-payload branch from 73b6661 to 0c04b74 Compare March 13, 2025 17:47

Verified

This commit was signed with the committer’s verified signature.
abdurrahman-ledger Abdurrahman Sastim
@robrichard robrichard force-pushed the robrichard/response-payload branch from 0c04b74 to bb5766e Compare March 13, 2025 17:50
@benjie benjie added the ✏️ Editorial PR is non-normative or does not influence implementation label Mar 13, 2025
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.

None yet

3 participants