The akka-http 2.4.7 reference states that it's possible to do custom Deserializer
s to convert query parameters, without storing them in an intermediate variable:
"amount".as[Int]
extract value of parameter "amount" as Int, you need a matching Deserializer in scope for that to work (see also Unmarshalling)
"amount".as(deserializer)
extract value of parameter "amount" with an explicit Deserializer
However, the Deserialized parameter sample on that page does not show how custom deserializers are being used.
How do I define one, so that I can say, e.g. .as[MyType]
?
I think the documentation is at fault, because I cannot find a Deserializer
mentioned anywhere in akka sources: search
Screenshot on how Deserializer
is typeset in the Akka docs.