GQL 查询的输入之一是案例类的嵌套列表。例如:
case class User (id: Int, name:String)
val user: InputObjectType[User] = deriveInputObjectType[User]
val arg = Argument("users", OptionInputType(ListInputType(ListInputType(user))))
当我运行应用程序时,我收到以下错误:
java.lang.ClassCastException: spray.json.JsArray cannot be cast to scala.collection.Seq
at sangria.marshalling.FromInput$SeqFromInput.fromResult(FromInput.scala:23)
at sangria.marshalling.FromInput$SeqFromInput.fromResult(FromInput.scala:19)
at sangria.marshalling.FromInput$SeqFromInput.$anonfun$fromResult$1(FromInput.scala:29)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:237)
at scala.collection.Iterator.foreach(Iterator.scala:941)
at scala.collection.Iterator.foreach$(Iterator.scala:941)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
at scala.collection.IterableLike.foreach(IterableLike.scala:74)
at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
at scala.collection.TraversableLike.map(TraversableLike.scala:237)
at scala.collection.TraversableLike.map$(TraversableLike.scala:230)
at scala.collection.AbstractTraversable.map(Traversable.scala:108)
at sangria.marshalling.FromInput$SeqFromInput.fromResult(FromInput.scala:25)
at sangria.marshalling.FromInput$SeqFromInput.fromResult(FromInput.scala:19)
at sangria.execution.ValueCollector$.$anonfun$getArgumentValues$6(ValueCollector.scala:149)
at sangria.execution.ValueCoercionHelper.resolveMapValue(ValueCoercionHelper.scala:162)
at sangria.execution.ValueCollector$.$anonfun$getArgumentValues$4(ValueCollector.scala:156)
at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
at scala.collection.immutable.List.foldLeft(List.scala:89)
at sangria.execution.ValueCollector$.getArgumentValues(ValueCollector.scala:132)
at sangria.execution.ValueCollector.getArgumentValues(ValueCollector.scala:103)
at sangria.execution.ValueCollector.$anonfun$getFieldArgumentValues$1(ValueCollector.scala:87)
at sangria.util.ConcurrentHashMapCache.getOrElseUpdate(ConcurrentHashMapCache.scala:29)
at sangria.execution.ValueCollector.getFieldArgumentValues(ValueCollector.scala:87)
at sangria.execution.Resolver.resolveField(Resolver.scala:1412)
at sangria.execution.Resolver.$anonfun$collectActionsPar$1(Resolver.scala:709)
at scala.collection.TraversableOnce.$anonfun$foldLeft$1(TraversableOnce.scala:160)
at scala.collection.TraversableOnce.$anonfun$foldLeft$1$adapted(TraversableOnce.scala:160)
at scala.collection.Iterator.foreach(Iterator.scala:941)
at scala.collection.Iterator.foreach$(Iterator.scala:941)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
at scala.collection.IterableLike.foreach(IterableLike.scala:74)
at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
at scala.collection.TraversableOnce.foldLeft(TraversableOnce.scala:160)
at scala.collection.TraversableOnce.foldLeft$(TraversableOnce.scala:158)
at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:108)
at sangria.execution.Resolver.collectActionsPar(Resolver.scala:699)
at sangria.execution.Resolver.resolveFieldsPar(Resolver.scala:45)
at sangria.execution.Executor.executeOperation(Executor.scala:275)
at sangria.execution.Executor.$anonfun$execute$7(Executor.scala:206)
at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:92)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:92)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:49)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
输入请求:
{
"users": [
[
{
"id": "8",
"name": "BEGINS_WITH"
},
{
"id": "8",
"name": "BEGINS_WITH"
}
],
[
{
"id": "8",
"name": "BEGINS_WITH"
}
]
]
}
任何帮助都会得到帮助。谢谢