Skip to content

Define "execution result" and "request error result" #1159

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

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

Conversation

robrichard
Copy link
Contributor

Follow up from #1135

This creates a definition for Execution Result and Request Error Result. The definition of Response is updated to include Execution Result, Request Error Result and Response Stream (for subscriptions).

Incremental Delivery will introduce additional types built on top of this change. I am currently thinking something like this:

type RequestErrorResult = {
  errors: Error[] // request errors only
  extensions?: object
}
type ExecutionResult = {
  data: {} | null
  errors?: Error[] // execution errors only
  extensions?: object
}
type ResponseStream = ExecutionResult[]
type IncrementalStream = [InitialExecutionResult, ...SubsequentExecutionResult];
type Response = RequestErrorResult | ExecutionResult | ResponseStream | IncrementalStream;

Copy link

netlify bot commented Apr 17, 2025

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit 1dbb9c6
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/68015ff06a83b30008751333
😎 Deploy Preview https://deploy-preview-1159--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.

Signed-off-by: Rob Richard <rob@1stdibs.com>
@robrichard robrichard force-pushed the robrichard/response branch from f2b4d37 to 1dbb9c6 Compare April 17, 2025 20:09
@robrichard robrichard added the ✏️ Editorial PR is non-normative or does not influence implementation label Apr 17, 2025
Comment on lines +26 to +30
If execution raised any errors, the _execution result_ must contain an entry
with key {"errors"}. The value of this entry must be a non-empty list of
_execution error_ raised during execution. Each error must be a map as described
in the "Errors" section below. If the request completed without raising any
errors, this entry must not be present.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved and adjusted some of the text from the Errors section. Placing it under Execution Result and Request Error Result so we can describe the specific behavior (must be included in Request Error Result, may be included in Execution Result) without the Errors section having conditions for each type.

If the {"data"} entry in the response is present (including if it is the value
{null}), the {"errors"} entry must be present if and only if one or more
_execution error_ was raised during execution.
The {"errors"} entry in the _execution result_ or _request error result_ is a
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also define a type Response Result that includes both Execution Result and Request Error Result as subtypes, but adding another layer of hierarchy might be less clear?

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.

1 participant