-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
Handle operation parsing error GraphQL #2434
Handle operation parsing error GraphQL #2434
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
CodSpeed Performance ReportMerging #2434 will not alter performanceComparing Summary
|
5cc07f8
to
79e3871
Compare
79e3871
to
83949bf
Compare
83949bf
to
797b369
Compare
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 seems that the parser can't correctly recover itself when parsing broken directives, and it keeps creating bogus nodes. We should review that part, otherwise we risk to create a CST bigger than it should be
GraphqlBogus { | ||
items: [ | ||
GraphqlBogus { | ||
items: [ |
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 doesn't seem right: two bogus nodes with two items
Plus, we already have GraphqlBogusSelection
. I am not sure what's the recovery strategy at the moment
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 reason there is a nested bogus nodes here was because in this case:
{
hero @deprecated(: "Deprecated")
}
The parser tried to parse (: "Deprecated")
as an GraphqlArgumentList
, but since this argument list has an invalid argument : "Deprecated"
the entire list was turn into a bogus node, which caused @deprecated(: "Deprecated")
to turn from a GraphqlDirective
to a bogus node (as it contained an bogus node instead of an argument list), which turned hero @deprecated(: "Deprecated")
from a GraphqlField
to a bogus node, caused a series of nested bogus nodes. Do you have any suggestions on how to improve this?
GraphqlBogus { | ||
items: [ | ||
[email protected] "(" [] [], | ||
GraphqlBogus { | ||
items: [ | ||
GraphqlBogus { | ||
items: [ |
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.
Same here. Ideally we should have a better recovering strategy
}, | ||
GraphqlBogus { | ||
items: [ | ||
GraphqlBogus { | ||
items: [ | ||
[email protected] "@" [] [], | ||
GraphqlBogus { | ||
items: [ | ||
[email protected] "(" [] [], | ||
GraphqlBogus { | ||
items: [ | ||
GraphqlBogus { | ||
items: [ |
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.
Maybe we should have smaller cases to better evaluate the recovery strategy. The parser seems to not know that is in recovery mode and keeps creating bogus nodes.
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 the same issue with the above but with this case:
{
hero @(: "Deprecated"
}
Summary
Handle parsing for operation in GraphQL parser
Test Plan
All the tests should pass