I have (OData) query params defined in my route like so:
parameters(('$top.as[Int].?, '$skip.as[Int].?)) { (top, skip) =>
I have the following rejection handler to handle all invalid parameters (handleAll):
RejectionHandler.newBuilder()
.handleAll[MalformedQueryParamRejection] { paramRejections =>
// paramRejections is a Seq[MalformedQueryParamRejection]
...
}
The problem is that when called with the following
some-endpoint?$top=invalid&$skip=invalid
The paramRejections
in the rejection handler has 2 entries, both for $top, instead of one for $top and one for $skip.
Seems related to the dollar sign on the params, since when I remove this things work as expected. Is this a known issue or is there a workaround available (that doesn't include removing the dollar sign)?
Note, it seems its only the rejection handler that has a problem with multiple params starting with the dollar sign, since this line in the route correctly assigns top and skip to the variables when $top and $skip are supplied with valid values in the URI:
parameters(('$top.as[Int].?, '$skip.as[Int].?)) { (top, skip) =>