-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Define 'execution' as in 'before execution begins' #894
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
6dedfe9
to
d7eaf72
Compare
I guess the question is why (or why not) some errors should be considered Request errors, for example, submitting a mutation operation when no mutation root type exists. it is the fault of the graphql user, so should be considered a request error by the rough explanation given, but it does not occur during the executing requests section. |
But if you don’t validate, you can get user errors during field execution so ??? |
For that specific case that should be something raised during validation; the |
@IvanGoncharov that definition while clean is a bit circular, whether or not a path should be empty depends on whether we have started execution… |
My second attempt, to produce "non-confusing criteria" 😄 |
I think that's a fair assessment: |
18b38cd
to
0e175cb
Compare
spec/Section 7 -- Response.md
Outdated
Note: Request errors (including those raised during {ExecuteRequest()}) occur | ||
before execution begins; when a request error is raised the `data` entry should |
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.
This is very hard for my brain to process. I may already be in ExecuteRequest()
but still before execution begins?This feels weird.
Do we have a formal definition of what "execution" is and when it starts that we could link to maybe?
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.
That's what the purpose of this PR is 💯
Execution begins the moment that the data
property should be added to the response, which is when the root selection set is executed (after validating variables, establishing a stream in the case of subscriptions, etc).
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.
I've taken a different tact by defining execution, see what you think.
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.
We define _execution_ as the process of executing the operation's root
selection set through {ExecuteSelectionSet()}, thus _execution_ begins when
{ExecuteSelectionSet()} is called for the first time in a request. The
{ExecuteRequest()} algorithm is a preamble for _execution_.
This is clarifying but also also adding more language to processs. I think a rename of ExecuteRequest()
would be even more clarifying.
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.
Why not both? We use the term "execution" thoughout the spec, it makes sense to have a definition for it IMO.
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.
Agreed.
UPDATE: 2025-04-03
There are various parts of the spec that relate to a concept of "execution":
data
should be producedAll of these things actually happen during
ExecuteRequest()
, which makes it confusing to the reader thatExecuteRequest()
is not itself considered execution despite the name.I've thus defined execution, and indicated that
ExecuteRequest()
contains the preamble for "execution", followed by "execution" itself.See also: #1154 which renames these algorithms for further clarity.
Previous description
This is cleared up in the "Errors" -> "Request errors" section just 20 lines later, but for people dipping in to see what should happen with "data" it may not be obvious that the concept of "before execution begins" and that of entering the "Executing Requests" and/or "Executing Operations" sections differs due to the subtlety of when "request errors" can be raised.