Option serialization in ServiceCall

Hi,
how can we serialize an optional object?
For example, here is the service method description:

def myMethod: ServiceCall[NotUsed, Option[MyObject]]

Error getting

MessageSerializer[Option[MyObject], _]

Hi @brabo-hi

Maybe you just use 404 Http error code instead an Option but if you really needs to use an Option you can implement you own messageSerializer that handle this kind of transformation and import him in the service Api that you have implemented

1 Like