-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat: GQL variables and operation name #2993
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2993 +/- ##
===========================================
+ Coverage 79.24% 79.41% +0.17%
===========================================
Files 328 329 +1
Lines 25209 25120 -89
===========================================
- Hits 19976 19949 -27
+ Misses 3795 3757 -38
+ Partials 1438 1414 -24
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 18 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
r := &request.Request{ | ||
Queries: make([]*request.OperationDefinition, 0), | ||
Mutations: make([]*request.OperationDefinition, 0), | ||
Subscription: make([]*request.OperationDefinition, 0), | ||
} |
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.
thought (out of scope): Since we are now following the specs and explicitly allowing only one operation even if multiple are defined, it probably makes sense to refactor the request.Request
type at some point.
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 allows multiple, but if multiple operations are defined, technically you're supposed to specify which named op to run within in the document
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.
6.1Executing Requests
To execute a request, the executor must have a parsed Document and a selected operation name to run if the document defines multiple operations, otherwise the document is expected to only contain a single operation.
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.
Additionally, I would like to support multiple operations in the future, to support something akin to sub queries.
So you can use the result of one query into the doc set of another query.
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 allows multiple, but if multiple operations are defined, technically you're supposed to specify which named op to run within in the document
My thought still stands here as although the gql can have multiple ops, the execution will only use one.
Additionally, I would like to support multiple operations in the future, to support something akin to sub queries.
We'll have to think carefully about the design of this one and that might also impact what request.Request
looks like.
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.
Additionally, I would like to support multiple operations in the future, to support something akin to sub queries.
So you can use the result of one query into the doc set of another query.
Can this be achieved with fragments?
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.
Additionally, I would like to support multiple operations in the future, to support something akin to sub queries.
So you can use the result of one query into the doc set of another query.
Can this be achieved with fragments?
I don't see how off the top of my head, but open to seeing what if anything you have in mind.
executeTestCase(t, test) | ||
} | ||
|
||
func TestQuerySimpleWithVariableDefaultValue(t *testing.T) { |
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.
todo: Please add a test that shows that defaults can be overwritten.
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.
LGTM. I like this change. There is some nice simplification in here that is much appreciated.
Just one todo to resolve before merge.
bug bash result: used different clients (Altair and Postman) to test variables and operation name. Worked as expected. |
Relevant issue(s)
Resolves #1441
Resolves #1395
Description
This PR adds support for GraphQL variables and operation name.
Tasks
How has this been tested?
Added tests
Specify the platform(s) on which this was tested: