Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1365

Parameter list as val in akka-http 10.2.x?

$
0
0

Below is a reduced example of something my akka-http 10.1.x code is doing, but no longer works in 10.2.x because of the ParamMagent / ParamSpec change. There’s no mention of how to migrate this in the migration guide, and I think think that would be a useful addition.

The basic case is that I have is a val tuple of parameters that I reuse in multiple routes. In 10.1.x, the ParamMagnet handled this. Now, I have two different problems:

  1. paramsTuple has NamedReceptacle types in it instead of ParamSpec
  2. After adding explicit typing that the paramsTuple should have ParamSpec types instead, I get the error that I can’t pass a tuple to parameters.
def r1(): Route =
    get {
      val paramsTuple = (
        "id".as[String],
        "query".as[String].?
      )
      parameters(
        paramsTuple
      ) {
        (
          id,
          query
        ) =>
          complete(OK, s"$id $query")
      }
    }

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1365

Trending Articles