Getting Parameters in query

37 views
Skip to first unread message

ashish mahindrakar

unread,
Mar 24, 2019, 4:09:22 AM3/24/19
to sangria-graphql
Hey All,
I'm trying a sangria example out, where i'm expecting my query to take both list of some strings and a single string as a argument.


like below mentioned example :

where my query for foo need two argument called ID and ListOfString and I'm not able pass/get it from arguments.

the error which I'm getting is like


`Type mismatch, expected: String, actual: Argument[Seq[String @@ FromInput.CoercedScalaResult]]`

can someone help me out please ?

val ID = Argument("id", StringType, description = "id of the character")
val ListOfString = Argument("list", ListInputType(StringType),"list of strings")

val QueryType = ObjectType("query",fields[FooRepo,Unit] (
Field("foo",OptionType(ListType(FooResponseType)),
description = Some("something"),
arguments = List(ID,ListOfString),
resolve = c ⇒ c.ctx.foo(c arg ID,c.arg(ListOfString))
)))
Reply all
Reply to author
Forward
0 new messages