This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-http.git
The following commit(s) were added to refs/heads/main by this push:
new 245d7f87c remove deprecated parameters directive (#764)
245d7f87c is described below
commit 245d7f87cec151b40e5a146948069b2394bf65fe
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Sep 12 10:15:44 2025 +0100
remove deprecated parameters directive (#764)
* remove deprecated parameters directive
* Update remove-deprecated-methods.excludes
---
.../remove-deprecated-methods.excludes | 13 +++
.../server/directives/ParameterDirectives.scala | 110 ---------------------
2 files changed, 13 insertions(+), 110 deletions(-)
diff --git
a/http/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
b/http/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
index 0862d64a4..5175e7ab8 100644
---
a/http/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
+++
b/http/src/main/mima-filters/2.0.x.backwards.excludes/remove-deprecated-methods.excludes
@@ -54,6 +54,19 @@
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scalad
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.LowerPriorityRouteResultImplicits")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.RouteResult.routeToFlowViaMaterializer")
ProblemFilters.exclude[MissingTypesProblem]("org.apache.pekko.http.scaladsl.server.RouteResult$")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.Directives.parameter")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.Directives.parameters")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.HttpApp.parameter")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.HttpApp.parameters")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives.parameter")
+ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives.parameters")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives$ParamDef")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives$ParamDef$")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives$ParamDef$ConvertParamDefAndConcatenate$")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives$ParamMagnet")
+ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives$ParamMagnet$")
+ProblemFilters.exclude[MissingFieldProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives.ParamMagnet")
+ProblemFilters.exclude[MissingFieldProblem]("org.apache.pekko.http.scaladsl.server.directives.ParameterDirectives.ParamDef")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.directives.FormFieldDirectives.formField")
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.http.scaladsl.server.directives.FormFieldDirectives.formFields")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.scaladsl.server.directives.FormFieldDirectives$FieldMagnet")
diff --git
a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/ParameterDirectives.scala
b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/ParameterDirectives.scala
index 984666241..0eac8eeac 100644
---
a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/ParameterDirectives.scala
+++
b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/ParameterDirectives.scala
@@ -48,26 +48,6 @@ trait ParameterDirectives extends
ParameterDirectivesInstances with ToNameRecept
* @group param
*/
def parameterSeq: Directive1[immutable.Seq[(String, String)]] = _parameterSeq
-
- /**
- * Extracts a query parameter value from the request.
- * Rejects the request if the defined query parameter matcher(s) don't match.
- *
- * @group param
- */
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- private[http] def parameter(pdm: ParamMagnet): pdm.Out = pdm()
-
- /**
- * Extracts a number of query parameter values from the request.
- * Rejects the request if the defined query parameter matcher(s) don't match.
- *
- * @group param
- */
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- private[http] def parameters(pdm: ParamMagnet): pdm.Out = pdm()
}
object ParameterDirectives extends ParameterDirectives {
@@ -130,96 +110,6 @@ object ParameterDirectives extends ParameterDirectives {
ParamSpec(requiredFilter(name, fsu, requiredValue).tmap(_ => Tuple1(())))
}
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- sealed trait ParamMagnet {
- type Out
- def apply(): Out
- }
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- object ParamMagnet {
- def apply[T](value: T)(implicit pdef: ParamDef[T]): ParamMagnet { type Out
= pdef.Out } =
- new ParamMagnet {
- type Out = pdef.Out
- def apply() = pdef(value)
- }
- }
-
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- type ParamDefAux[T, U] = ParamDef[T] { type Out = U }
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- sealed trait ParamDef[T] {
- type Out
- def apply(value: T): Out
- }
- @deprecated("Use new `parameters` overloads with ParamSpec parameters. Kept
for binary compatibility",
- "Akka HTTP 10.2.0")
- object ParamDef {
- import Impl._
- import pekko.http.scaladsl.unmarshalling.{ FromStringUnmarshaller => FSU }
-
- def paramDef[A, B](f: A => B): ParamDefAux[A, B] =
- new ParamDef[A] {
- type Out = B
- def apply(value: A) = f(value)
- }
- def extractParameter[A, B](f: A => Directive1[B]): ParamDefAux[A,
Directive1[B]] = paramDef(f)
-
- def forString(implicit fsu: FSU[String]): ParamDefAux[String,
Directive1[String]] =
- extractParameter[String, String] { string => filter(string, fsu) }
- def forSymbol(implicit fsu: FSU[String]): ParamDefAux[Symbol,
Directive1[String]] =
- extractParameter[Symbol, String] { symbol => filter(symbol.name, fsu) }
- def forNR[T](implicit fsu: FSU[T]): ParamDefAux[NameReceptacle[T],
Directive1[T]] =
- extractParameter[NameReceptacle[T], T] { nr => filter(nr.name, fsu) }
- def forNUR[T]: ParamDefAux[NameUnmarshallerReceptacle[T], Directive1[T]] =
- extractParameter[NameUnmarshallerReceptacle[T], T] { nr =>
filter(nr.name, nr.um) }
- def forNOR[T](implicit fsou: FSOU[T]):
ParamDefAux[NameOptionReceptacle[T], Directive1[Option[T]]] =
- extractParameter[NameOptionReceptacle[T], Option[T]] { nr =>
filter[Option[T]](nr.name, fsou) }
- def forNDR[T](implicit fsou: FSOU[T]):
ParamDefAux[NameDefaultReceptacle[T], Directive1[T]] =
- extractParameter[NameDefaultReceptacle[T], T] { nr => filter[T](nr.name,
fsou.withDefaultValue(nr.default)) }
- def forNOUR[T]: ParamDefAux[NameOptionUnmarshallerReceptacle[T],
Directive1[Option[T]]] =
- extractParameter[NameOptionUnmarshallerReceptacle[T], Option[T]] { nr =>
filter(nr.name, nr.um: FSOU[T]) }
- def forNDUR[T]: ParamDefAux[NameDefaultUnmarshallerReceptacle[T],
Directive1[T]] =
- extractParameter[NameDefaultUnmarshallerReceptacle[T], T] { nr =>
- filter[T](nr.name, (nr.um: FSOU[T]).withDefaultValue(nr.default))
- }
-
- //////////////////// required parameter support ////////////////////
-
- def forRVR[T](implicit fsu: FSU[T]):
ParamDefAux[RequiredValueReceptacle[T], Directive0] =
- paramDef[RequiredValueReceptacle[T], Directive0] { rvr =>
requiredFilter(rvr.name, fsu, rvr.requiredValue) }
- def forRVDR[T]: ParamDefAux[RequiredValueUnmarshallerReceptacle[T],
Directive0] =
- paramDef[RequiredValueUnmarshallerReceptacle[T], Directive0] { rvr =>
- requiredFilter(rvr.name, rvr.um, rvr.requiredValue)
- }
-
- //////////////////// repeated parameter support ////////////////////
-
- def forRepVR[T](implicit fsu: FSU[T]):
ParamDefAux[RepeatedValueReceptacle[T], Directive1[Iterable[T]]] =
- extractParameter[RepeatedValueReceptacle[T], Iterable[T]] { rvr =>
repeatedFilter(rvr.name, fsu) }
- def forRepVDR[T]: ParamDefAux[RepeatedValueUnmarshallerReceptacle[T],
Directive1[Iterable[T]]] =
- extractParameter[RepeatedValueUnmarshallerReceptacle[T], Iterable[T]] {
rvr => repeatedFilter(rvr.name, rvr.um) }
-
- //////////////////// tuple support ////////////////////
-
- import pekko.http.scaladsl.server.util.TupleOps._
- import pekko.http.scaladsl.server.util.BinaryPolyFunc
-
- // not implicit any more
- private[http] def forTuple[T](
- implicit fold: FoldLeft[Directive0, T,
ConvertParamDefAndConcatenate.type]): ParamDefAux[T, fold.Out] =
- paramDef[T, fold.Out](fold(BasicDirectives.pass, _))
-
- object ConvertParamDefAndConcatenate extends BinaryPolyFunc {
- implicit def from[P, TA, TB](implicit pdef: ParamDef[P] { type Out =
Directive[TB] }, ev: Join[TA, TB])
- : BinaryPolyFunc.Case[Directive[TA], P,
ConvertParamDefAndConcatenate.type] { type Out = Directive[ev.Out] } =
- at[Directive[TA], P] { (a, t) => a & pdef(t) }
- }
- }
-
/** Actual directive implementations shared between old and new API */
private object Impl {
import BasicDirectives._
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]