Closed evbo closed 6 years ago
Hi @evbo !
I think you miss the var definition in the query sentence:
val query =
graphql"""
query getPeople($fams: String) {
getPeople(families: [$fams]) {
name
}
}
"""
also the last error could be that you miss to import circe, to have the json decoder for People and List. Try with:
import io.circe._, io.circe.generic.auto._
Thanks, and I really appreciate you making this library, but since posting I've been under a tight deadline to get something working so I've implemented a fairly light weight Sangria client of my own. Just a bare bones simple akka post or get request with circe marshaling using only simple case classes to avoid complex encoding/decoding. Unless there's something else I haven't accounted for I may just stick with this approach.
thanks for getting back to me though. Love the title of this repo too, though it's a challenge to google :)
Rats. I'm having these exact same issues.
Unlike the examples, I had to escape $
in the query with $$
, as my Scala compiler was interpreting $
as string interpolation. So something like
val query =
graphql"""
query getPeople($$fams: String) {
getPeople(families: [$$fams]) {
name
}
}
"""
worked for me.
Regarding the decoders, I did have to use io.circe.generic.auto._
as shown above instead of io.circe.generic.semiauto._
as shown in the README.
There was also some Akka version dependency incompatibility that I was able to fix by including "com.typesafe.akka" %% "akka-actor" % "2.5.19"
as a dependency in my project.
Hello from a future Google searcher --
I gave up with this and used QueryParser.parse(s""" ... ${InterpolationVariable} ... """).get
instead.
Hope this helps.
I am trying to use drunk for the client to make user selected requests, where vars will vary depending on what the user has selected.
Since String interpolation isn't supported yet, I tried following how variables are defined in the readme, but now I'm getting compilation error:
not found: value fams
.Here's what I'm attempting to do. ``:
If I skip variable definitions, and just hardcode the families input, I'm still getting an error about a decoder missing: