Hello,
I'm working on client library wrapper for an api and would like to have the following generic pipeline processing method:
def request[T: Manifest](req: MyRequest): MyResponse[T] = {
val pipeline = sendReceive ~> unmarshal[T]
......
val responseFuture = pipeline { req }
responseFuture. map {
....
} // return MyResponse[T]
}
You can see that I use Manifest to provide type information to successfully apply unmarchal[T]
It works if I use liftJson library with providing implicits:
implicit val liftJsonFormats: Formats = Serialization.formats(NoTypeHints) ++ JodaTimeSerializers.all
For some reason I would like to use SprayJson and do the following in spray.examples:
object MyJsonProtocols extends DefaultJsonProtocol {
implicit val MyClassFormat = jsonFormat2(MyClass)
}
and import it with
import MyJsonProtocols._
import SprayJsonSupport._
But unfortunately I get the following issue:
could not find implicit value for evidence parameter of type spray.httpx.unmarshalling.FromResponseUnmarshaller[T]
[error] val pipeline = sendReceive ~> unmarshal[T]
Can you please advise the way to implement generic pipeline processing with SprayJson? Thanks!