Konrad, Thanks for the reply!
In fact I have the very same code separation:
*object ApiJsonProtocol extends ApiJsonProtocoltrait ApiJsonProtocol
extends SprayJsonSupport with DefaultJsonProtocol { implicit val
feedFormat = jsonFormat2(Feed) // implicit val feedsWriter =
seqFormat[Feed]}*
*class FeedRoute(feedRepository: FeedRepository) extends ApiRoute with
ApiJsonProtocol {*
* override val underlying: Route = {*
* pathPrefix("feeds") {*
*pathEndOrSingleSlash {*
*get {*
*parameters('from.as[Int] ? 0, 'limit.as[Int] ? 10, 'title ? "") { (from,
limit, title) =>*
*complete(*
*// TODO use (from, limit, title)*
*feedRepository.findAll()*
*)*
*}*
*}*
*}*
* }*
*}*
*}*
But without the extra "*implicit val feedsWriter = seqFormat[Feed]*" it
does not compile.
On GitHub I've found several examples of people trying to solve the same
problem:
1) Use of .toJson before wrapping into complete(...)
https://github.com/ArchDev/akka-http-rest/blob/master/src/main/scala/me/archdev/restapi/http/routes/UsersServiceRoute.scala
2) Declaring implicit val for each Seq[of somethings] but in this
particular case the author went further and coded full RootJsonWriter
https://github.com/dit4c/dit4c/blob/f66f833ef35d58234391e9e0f09ad36b7a4a6206/dit4c-machineshop/src/main/scala/dit4c/machineshop/ApiService.scala
So, it appears I'm not the only one who finds this a little bit confusing.
Regards,
Ilya
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.