Skip to content
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

Ability to Pass GraphQL Variable in Client Side Request Payload #1156

Open
ruipliu opened this issue Apr 11, 2023 · 0 comments
Open

Ability to Pass GraphQL Variable in Client Side Request Payload #1156

ruipliu opened this issue Apr 11, 2023 · 0 comments

Comments

@ruipliu
Copy link

ruipliu commented Apr 11, 2023

Is your feature request related to a problem? Please describe.
There is a query caching mechanism in graphql-java to cache the client query to reusable PreparsedDocumentEntry so that latter queries will no longer need to parse the query trees. I analyzed that this cache is useful to increase performance for GraphQL applications that usually takes in complicated but limited queries.

The query caching document suggests to move parameters and arguments into query variables to achieve high cache hit ratio, which is currently not provided by our client side code generator.

Describe the solution you'd like
Add query variables in GraphQL request payload, which requires client code generator adding a new feature. Currently if we use generated code, all variables are hard-coded in the query body itself.

The ideal scenario would be:
When new GraphQLRequest(operationRequest, responseProjection) is called, the inside logic can extract all arguments (including input type) into query variables.

Describe alternatives you've considered
The queries could be alternatively parsed by manipulating the string and extracting variables, either in client side before performing HTTP call, or in server side once we receive the request payload. But it would be better for the library to have this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant