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
execute: Correctly report missing root type error #3308
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@yaacovCR Probably it should be just
errors
withoutdata
, what do 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.
The spec is unclear, sometimes it says that if execution fails because of missing information, you should just errors, sometimes it says that if execution starts, you should get some data, and it is internally contradictory on whether request execution is considered execution for these purposes, definitionally it calls it execution, but the parts of execution seem validation like, and so in the subsections it says to return only errors and that “execution” is considered to start only with operation execution @benjie has a bit in the glossary about this maybe he has thoughts
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.
Because of that ambiguity in requests, where it is called execution even though later not considered execution, I am inclined to say the same is possibly true in the execution operations section, so we can return just errors
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.
But the spec should be clarified, I think, so kind of doesnt matter what we choose, except if we can anticipate how we would like this to go, in terms of usefulness for clients, I don’t even know what the right answer is, in general, documents should be validated, so this case shouldn’t even come up, so I would say should be similar to any missing field where document not validated where I assume null is returned so data should be null here
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.
Although currently the subscribe code I think just returns errors, that’s the better option there because data for subscribe belongs only in payloads. So maybe consistency with subscribe for execute means data should be skipped for all the operations
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.
From Response/Response Format/Data:
From Executing Requests:
From ExecuteQuery():
Assuming that this error is triggered by the assert above, then it's part of the execution process and thus the
data
should be null. Interesting that this is ashould
not a must, actually. Anyway; since we're the reference implementation we should follow theshould
.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.
Just so I understand that is because the assertion is made in the operation execution algorithm section, and not the request execution section? Or is either section considered execution? Variable coercion section says:
If a request error is encountered during input coercion of variable values, then the operation fails without execution.
That is ambiguous itself seems to mean operation execution, as opposed to request execution.
Anyways, we should align subscription behavior to whatever we do for queries
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 think you’re right; there is ambiguity there. I’ll have a go at adding some clarity.
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.
It turns out that this is addressed a couple paragraphs lower down:
https://spec.graphql.org/draft/#sec-Errors.Request-errors
Namely:
ExecuteRequest()
can raise "request errors" which are deemed to occur "before execution begins". So "execution" refers to neither "operation execution" nor "request execution" but to the phase of request/operation execution that occurs after the last possible point at which a request error could be raised. Note this could be during theCreateSourceEventStream()
algorithm.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.
Here's my attempt to clarify this with a non-normative note: graphql/graphql-spec#894