diff --git a/docs/generators/scala-akka-http-server.md b/docs/generators/scala-akka-http-server.md index 5fea9907929..4dfa451cb31 100644 --- a/docs/generators/scala-akka-http-server.md +++ b/docs/generators/scala-akka-http-server.md @@ -18,7 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | -|akkaHttpVersion|The version of akka-http| |10.1.10| +|akkaHttpVersion|The version of akka-http| |10.2.9| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| |artifactId|artifactId| |openapi-scala-akka-http-server| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java index eb076d4b200..3fb7d1d7f68 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaHttpServerCodegen.java @@ -51,7 +51,7 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements public static final String AKKA_HTTP_VERSION_DESC = "The version of akka-http"; public static final String PEKKO_HTTP_VERSION = "pekkoHttpVersion"; public static final String PEKKO_HTTP_VERSION_DESC = "The version of pekko-http"; - public static final String DEFAULT_AKKA_HTTP_VERSION = "10.1.10"; + public static final String DEFAULT_AKKA_HTTP_VERSION = "10.2.9"; public static final String DEFAULT_PEKKO_HTTP_VERSION = "1.1.0"; public static final String GENERATE_AS_MANAGED_SOURCES = "asManagedSources"; diff --git a/modules/openapi-generator/src/main/resources/scala-akka-http-server/build.sbt.mustache b/modules/openapi-generator/src/main/resources/scala-akka-http-server/build.sbt.mustache index eaca841e2be..b8af4b06319 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-http-server/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-http-server/build.sbt.mustache @@ -1,11 +1,16 @@ version := "{{artifactVersion}}" name := "{{artifactId}}" organization := "{{groupId}}" -scalaVersion := "2.12.20" +scalaVersion := "2.13.16" libraryDependencies ++= Seq({{#useApachePekko}} - "org.apache.pekko" %% "pekko-stream" % "1.0.3", + "org.apache.pekko" %% "pekko-stream" % "1.1.3", "org.apache.pekko" %% "pekko-http" % "{{pekkoHttpVersion}}"{{/useApachePekko}}{{^useApachePekko}} - "com.typesafe.akka" %% "akka-stream" % "2.5.21", + "com.typesafe.akka" %% "akka-stream" % "2.6.21", "com.typesafe.akka" %% "akka-http" % "{{akkaHttpVersion}}"{{/useApachePekko}} ) + +scalacOptions ++= Seq( + "-deprecation", + "-feature", +) diff --git a/modules/openapi-generator/src/main/resources/scala-akka-http-server/controller.mustache b/modules/openapi-generator/src/main/resources/scala-akka-http-server/controller.mustache index b67a75b83c1..f5025b87218 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-http-server/controller.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-http-server/controller.mustache @@ -6,11 +6,11 @@ import {{akkaImportGroupId}}.http.scaladsl.server.Route {{/operations}}{{/apis}}{{/apiInfo}} import {{akkaImportGroupId}}.http.scaladsl.server.Directives._ import {{akkaImportGroupId}}.actor.ActorSystem -import {{akkaImportGroupId}}.stream.ActorMaterializer +import {{akkaImportGroupId}}.stream.Materializer -class Controller({{#apiInfo}}{{#apis}}{{#operations}}{{classVarName}}: {{classname}}{{^-last}}, {{/-last}}{{/operations}}{{/apis}}{{/apiInfo}})(implicit system: ActorSystem, materializer: ActorMaterializer) { +class Controller({{#apiInfo}}{{#apis}}{{#operations}}{{classVarName}}: {{classname}}{{^-last}}, {{/-last}}{{/operations}}{{/apis}}{{/apiInfo}})(implicit system: ActorSystem, materializer: Materializer) { lazy val routes: Route = {{#apiInfo}}{{#apis}}{{#operations}}{{classVarName}}.route {{^-last}}~ {{/-last}}{{/operations}}{{/apis}}{{/apiInfo}} - Http().bindAndHandle(routes, "0.0.0.0", 9000) -} \ No newline at end of file + Http().newServerAt("0.0.0.0", 9000).bind(routes) +} diff --git a/modules/openapi-generator/src/main/resources/scala-akka-http-server/stringDirectives.mustache b/modules/openapi-generator/src/main/resources/scala-akka-http-server/stringDirectives.mustache index 5ee2f6035f9..d8471c6094c 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-http-server/stringDirectives.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-http-server/stringDirectives.mustache @@ -6,6 +6,7 @@ import {{akkaImportGroupId}}.http.scaladsl.server.directives.BasicDirectives import {{akkaImportGroupId}}.http.scaladsl.unmarshalling.Unmarshaller.UnsupportedContentTypeException import scala.concurrent.Future +import scala.language.implicitConversions import scala.util.{Failure, Success} trait StringDirectives { diff --git a/samples/server/petstore/scala-akka-http-server/build.sbt b/samples/server/petstore/scala-akka-http-server/build.sbt index cef46671e86..fcd88629e27 100644 --- a/samples/server/petstore/scala-akka-http-server/build.sbt +++ b/samples/server/petstore/scala-akka-http-server/build.sbt @@ -1,9 +1,14 @@ version := "1.0.0" name := "openapi-scala-akka-http-server" organization := "org.openapitools" -scalaVersion := "2.12.20" +scalaVersion := "2.13.16" libraryDependencies ++= Seq( - "com.typesafe.akka" %% "akka-stream" % "2.5.21", - "com.typesafe.akka" %% "akka-http" % "10.1.10" + "com.typesafe.akka" %% "akka-stream" % "2.6.21", + "com.typesafe.akka" %% "akka-http" % "10.2.9" +) + +scalacOptions ++= Seq( + "-deprecation", + "-feature", ) diff --git a/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/Controller.scala b/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/Controller.scala index 8cfc986a0aa..b537152e445 100644 --- a/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/Controller.scala +++ b/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/Controller.scala @@ -8,11 +8,11 @@ import org.openapitools.server.api.UserApi import akka.http.scaladsl.server.Directives._ import akka.actor.ActorSystem -import akka.stream.ActorMaterializer +import akka.stream.Materializer -class Controller(pet: PetApi, store: StoreApi, user: UserApi)(implicit system: ActorSystem, materializer: ActorMaterializer) { +class Controller(pet: PetApi, store: StoreApi, user: UserApi)(implicit system: ActorSystem, materializer: Materializer) { lazy val routes: Route = pet.route ~ store.route ~ user.route - Http().bindAndHandle(routes, "0.0.0.0", 9000) -} \ No newline at end of file + Http().newServerAt("0.0.0.0", 9000).bind(routes) +} diff --git a/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala b/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala index 2d115849056..20392968fdc 100644 --- a/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala +++ b/samples/server/petstore/scala-akka-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala @@ -6,6 +6,7 @@ import akka.http.scaladsl.server.directives.BasicDirectives import akka.http.scaladsl.unmarshalling.Unmarshaller.UnsupportedContentTypeException import scala.concurrent.Future +import scala.language.implicitConversions import scala.util.{Failure, Success} trait StringDirectives { diff --git a/samples/server/petstore/scala-pekko-http-server/build.sbt b/samples/server/petstore/scala-pekko-http-server/build.sbt index 2f87c22d655..24de1ebf72b 100644 --- a/samples/server/petstore/scala-pekko-http-server/build.sbt +++ b/samples/server/petstore/scala-pekko-http-server/build.sbt @@ -1,9 +1,14 @@ version := "1.0.0" name := "openapi-scala-pekko-http-server" organization := "org.openapitools" -scalaVersion := "2.12.20" +scalaVersion := "2.13.16" libraryDependencies ++= Seq( - "org.apache.pekko" %% "pekko-stream" % "1.0.3", + "org.apache.pekko" %% "pekko-stream" % "1.1.3", "org.apache.pekko" %% "pekko-http" % "1.1.0" ) + +scalacOptions ++= Seq( + "-deprecation", + "-feature", +) diff --git a/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/Controller.scala b/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/Controller.scala index 58b99cbe0ee..6ccfb2a987a 100644 --- a/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/Controller.scala +++ b/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/Controller.scala @@ -8,11 +8,11 @@ import org.openapitools.server.api.UserApi import org.apache.pekko.http.scaladsl.server.Directives._ import org.apache.pekko.actor.ActorSystem -import org.apache.pekko.stream.ActorMaterializer +import org.apache.pekko.stream.Materializer -class Controller(pet: PetApi, store: StoreApi, user: UserApi)(implicit system: ActorSystem, materializer: ActorMaterializer) { +class Controller(pet: PetApi, store: StoreApi, user: UserApi)(implicit system: ActorSystem, materializer: Materializer) { lazy val routes: Route = pet.route ~ store.route ~ user.route - Http().bindAndHandle(routes, "0.0.0.0", 9000) -} \ No newline at end of file + Http().newServerAt("0.0.0.0", 9000).bind(routes) +} diff --git a/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala b/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala index 6e83b56aa6f..ebc95e69a7c 100644 --- a/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala +++ b/samples/server/petstore/scala-pekko-http-server/src/main/scala/org/openapitools/server/StringDirectives.scala @@ -6,6 +6,7 @@ import org.apache.pekko.http.scaladsl.server.directives.BasicDirectives import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshaller.UnsupportedContentTypeException import scala.concurrent.Future +import scala.language.implicitConversions import scala.util.{Failure, Success} trait StringDirectives {