Skip to content

Add support for sending queries by name #16

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

Open
oliemansm opened this issue Dec 23, 2020 · 1 comment
Open

Add support for sending queries by name #16

oliemansm opened this issue Dec 23, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@oliemansm
Copy link
Member

oliemansm commented Dec 23, 2020

GraphQLWebClient uses the GraphQLRequest which contains the query to send. That GraphQLRequest object is constructed using the GraphQLRequestBuilder which in turn exposes two ways of defining the query:

  1. String parameter identifying a classpath resource, e.g. some-query-file.graphql
  2. The actual String query

Describe the solution you'd like
Add the ability to send a query (e.g. construct a GraphQLRequest) using named queries. You could add resource file(s) containing named GraphQL queries, e.g.

query getSomeQuery($id: ID!) {
  someQuery(id: $id)
}

Upon startup these queries would be preloaded and they could be used by providing the query name, e.g.

GraphQLRequest.builder().namedQuery("getSomeQuery").build()
@oliemansm oliemansm added the enhancement New feature or request label Dec 23, 2020
@kevinding888
Copy link

I followed your read.me instructions but still could not figure out how to apply the to my following query that I typically test using the UI. Any tips with examples?

mutation {
searchBySerialNumber(ean:"9780838402597",serialNumber:"100959358686")
{
ean
isReturnable
dueDate
userId
trackingNumber
}
}

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

No branches or pull requests

2 participants