-
Notifications
You must be signed in to change notification settings - Fork 58
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
Variables are not supported #51
Comments
how are you calling Passing variables is split into 2 different arguments. Here's an example: val dollarSign = '$'
val query = """
query(${dollarSign}id: Int! = 6){
TruckLoad(id: ${dollarSign}id) {
id
TruckLoad{
id
}
}
}""".trimIndent()
val variables = """
{
"id": 5
}
""".trimIndent()
val res = schema.execute(query, variables)
println(res) |
Using ktor:
|
I'm planning to do a module for ktor, so in the feature you would just install KGraphQL into ktor something like this: embeddedServer(...) {
install(KGraphQL)
} But for for you could take a look at this project: https://github.com/jeggy/ktorgraphql/blob/master/src/Application.kt#L55 |
I think I saw a PR or something about that in ktor's project. do you have a link? |
I've seen some that are using the java implementation of GraphQL. But I haven't seen any for KGraphQL. |
I'm sorry, I got confused |
When creating a query like the following, I get a 500 error.
The endpoint throws an exception about a null argument
com.apurebase.kgraphql.RequestException: argument id is not optional, value cannot be null
However, if I specify a default variable, like the following, the endpoint returns, but only using the default value (
2
in this example) instead of the defined variable (5
in this example)The text was updated successfully, but these errors were encountered: