question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for query variables

See original GitHub issue

It looks like express-graphql and graphql-ruby accept queries with query and variables in separate structures. For example, here is a query generated by the express-graphql client library.

{
   "query":"query AppHomeRoute($uuid_0:String!) {
         account(uuid:$uuid_0) { 
               ...
         }
     }",
   "variables":{"uuid_0":"88888888-4444-4444-4444-121212121212"}
}

Here are a couple articles discussing variables:

It doesn’t look like the graphql-java server accepts query variables like this currently. It seems like this would be a nice feature to have, so you can use graphql-java servers with the relay-starter-kit.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
andimarekcommented, Sep 11, 2017

@SebastianWjertzoch as mentioned above: you have to declare the variable.

you query is

query { person(id: $personId) { id, name } }

but it is missing the declaration of the variable. It should like this:

query myQuery($personId: Int) { person(id: $personId) { id, name } }

I hope this helps

2reactions
andimarekcommented, Sep 11, 2017

well … if you wanna use a variable you have to declare the variable.

the query you mention works fine, because you don’t use a variable, hence you don’t have to declare it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for variables in plugins | Grafana documentation
Query variables is a type of variable that allows you to query a data source for the values. By adding support for query...
Read more >
Query Variables - Arctype
Query variables allow values to be attached to variables so that a single value ... Query variables support String, Number, Date, and Boolean...
Read more >
How to use GraphQL variables to give queries type safety
Click on the query variables pane at the bottom of the GraphiQL explorer. Create an object, and add your stringified variable name and...
Read more >
Use parameters to ask for input when running a query
Parameter A parameter is a piece of information you supply to a query right as you run it. Parameters can be used by...
Read more >
Query Variables - PopSQL
Reusable and flexible queries, powered by query variables. Pass parameters into queries with a simple UI. Make your SQL versatile with if/else statements....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found