Hi Mohnish,
On Thu, May 7, 2015 at 8:26 AM, Mohnish Kodnani
<
mohnish...@gmail.com> wrote:
> This works and I can also return Option[Result] and Future[Option[Result]].
>
> Then I have another route, which returns List[Option[Result]]] and that is
> giving an error saying "Expression of type List[Option[Result]] does not
> conform to type ToResponseMarshallable.
>
>
> Do I have to specify how to serialize a list of Result type to make this
> work ?
Yes, exactly. As you noticed we have automatic support for the
`Option` type, where `None` values are rendered to a `404 NotFound`
response [1] (which, in fact, may or may not be what you want). For
marshalling Lists there is no such intuitive behavior and it depends
on the content-type you are rendering to how such a list should be
rendered.
--
Johannes
[1]
https://github.com/spray/spray/blob/master/spray-httpx/src/main/scala/spray/httpx/marshalling/MetaToResponseMarshallers.scala#L25
-----------------------------------------------
Johannes Rudolph
http://virtual-void.net