Skip to content

Commit 0e7c7c2

Browse files
committed
chore: update smithy, smithy4play and akka
1 parent 00df9e2 commit 0e7c7c2

File tree

16 files changed

+30
-25
lines changed

16 files changed

+30
-25
lines changed

.bin/setup/src/main/scala/packagedomain/smithyfiles/ApiDefinition.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ case class ApiDefinition(packageDomain: String, packageName: String) extends Smi
2020
|$$version: "1.0"
2121
|
2222
|namespace ${config.project.getNamespace()}.api
23-
|use smithy4s.api#simpleRestJson
23+
|use alloy#simpleRestJson
2424
|
2525
|@simpleRestJson
2626
|service $name {

app/de/innfactory/bootstrapplay2/application/controller/BaseController.scala

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import de.innfactory.smithy4play.{ContextRouteError, RoutingContext}
99
import play.api.Application
1010
import de.innfactory.play.smithy4play.{AbstractBaseController, HttpHeaders}
1111
import de.innfactory.play.smithy4play.ImplicitLogContext
12+
import play.api.libs.json.{JsValue, Json}
1213

1314
import scala.concurrent.ExecutionContext
1415

@@ -28,19 +29,20 @@ class BaseController(implicit ec: ExecutionContext, app: Application)
2829
result
2930
}
3031

32+
case class ErrorJson(message: String, additionalInfoErrorCode: Option[String])
33+
34+
private val writes = Json.writes[ErrorJson]
35+
3136
override def errorHandler(e: ResultStatus): ContextRouteError =
3237
e match {
3338
case result: ErrorResult =>
3439
new ContextRouteError {
3540
override def message: String = result.message
36-
override def additionalInfoToLog: Option[String] = result.additionalInfoToLog
37-
override def additionalInfoErrorCode: Option[String] = result.additionalInfoErrorCode
3841
override def statusCode: Int = result.statusCode
39-
40-
override def additionalInformation: Option[String] = None
42+
override def toJson: JsValue = Json.toJson(ErrorJson(result.message, result.additionalInfoErrorCode))(writes)
4143
}
4244
}
4345

4446
override def createRequestContextFromRoutingContext(r: RoutingContext): RequestContext =
45-
new RequestContext(HttpHeaders(r.map))
47+
new RequestContext(HttpHeaders(r.headers))
4648
}

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ lazy val api = (project in file("modules/api"))
148148
scalaVersion := Dependencies.scalaVersion,
149149
libraryDependencies ++= Dependencies.list,
150150
GithubConfig.settings,
151-
Compile / smithy4sInputDir := (ThisBuild / baseDirectory).value / "modules" / "api-definition" / "src" / "main" / "resources" / "META-INF" / "smithy",
151+
Compile / smithy4sInputDirs := Seq((ThisBuild / baseDirectory).value / "modules" / "api-definition" / "src" / "main" / "resources" / "META-INF" / "smithy"),
152152
Compile / smithy4sOutputDir := (ThisBuild / baseDirectory).value / "modules" / "api" / "src" / "main" / "scala"
153153
)
154154
lazy val apiDefinition = project in file("modules/api-definition")
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
2-
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.16.5")
2+
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.17.19")

modules/api-definition/src/main/resources/META-INF/smithy/actorShardingAPIController.smithy

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$version: "2.0"
22

33
namespace de.innfactory.bootstrapplay2.api
4-
use smithy4s.api#simpleRestJson
4+
use alloy#simpleRestJson
55

66
@simpleRestJson
77
service ActorShardingAPIController {

modules/api-definition/src/main/resources/META-INF/smithy/actorSystemAPIController.smithy

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$version: "2.0"
22

33
namespace de.innfactory.bootstrapplay2.api
4-
use smithy4s.api#simpleRestJson
4+
use alloy#simpleRestJson
55

66
@simpleRestJson
77
service ActorSystemAPIController {

modules/api-definition/src/main/resources/META-INF/smithy/base.smithy

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$version: "2.0"
22

33
namespace de.innfactory.bootstrapplay2.api
4-
use smithy4s.api#uuidFormat
4+
use alloy#uuidFormat
55

66
@pattern("^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(\\.\\d+)?(([+-]\\d\\d:\\d\\d)|Z)?$")
77
@documentation("ISO Date With Time")

modules/api-definition/src/main/resources/META-INF/smithy/companyAPIController.smithy

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ $version: "2.0"
33
namespace de.innfactory.bootstrapplay2.api
44

55
use de.innfactory.bootstrapplay2.api#CompanyId
6-
use smithy4s.api#simpleRestJson
6+
use alloy#simpleRestJson
77

88
@simpleRestJson
99
@httpBearerAuth

modules/api-definition/src/main/resources/META-INF/smithy/healthAPIController.smithy

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $version: "2.0"
22

33
namespace de.innfactory.bootstrapplay2.api
44

5-
use smithy4s.api#simpleRestJson
5+
use alloy#simpleRestJson
66

77
@simpleRestJson
88
service HealthAPIController {

modules/api-definition/src/main/resources/META-INF/smithy/locationAPIController.smithy

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace de.innfactory.bootstrapplay2.api
44

55
use de.innfactory.bootstrapplay2.api#LocationId
66
use de.innfactory.bootstrapplay2.api#CompanyId
7-
use smithy4s.api#simpleRestJson
7+
use alloy#simpleRestJson
88

99
@simpleRestJson
1010
@httpBearerAuth

project/Dependencies.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sbt._
44
object Dependencies {
55

66
val scalaVersion = "2.13.8"
7-
val akkaVersion = "2.6.20"
7+
val akkaVersion = "2.6.21"
88
val akkaManagementVersion = "1.1.3"
99

1010
val akkaTyped = "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion
@@ -25,7 +25,7 @@ object Dependencies {
2525

2626
// innFactory Utils
2727
val scalaUtil = "de.innfactory.scala-utils" %% "scala-utils" % "2.0.1"
28-
val smithy4play = "de.innfactory" %% "smithy4play" % "0.3.1"
28+
val smithy4play = "de.innfactory" %% "smithy4play" % "0.4.4-alpha"
2929

3030
// Prod
3131
val slickPg = "com.github.tminglei" %% "slick-pg" % "0.20.4"

project/plugins.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ addSbtPlugin("com.github.tototoshi" % "sbt-slick-codegen" % "1.4.0")
1313

1414
// The Play plugin
1515
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.0-RC2")
16-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
16+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
1717
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
1818
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
1919

2020
addSbtPlugin("com.typesafe.sbt" % "sbt-license-report" % "1.2.0")
2121

2222
addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
2323

24-
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.16.5")
24+
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.17.19")

test/controllers/ActorControllerTest.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ import java.nio.charset.StandardCharsets
1111

1212
class ActorControllerTest extends PlaySpec with BaseOneAppPerSuite with TestApplicationFactory {
1313
private val actorSystemClient =
14-
ActorSystemAPIControllerGen.withClient(new FakeRequestClient(), Some(Map("Authorization" -> Seq("key"))))
14+
ActorSystemAPIControllerGen.withClientAndHeaders(new FakeRequestClient(), Some(Map("Authorization" -> Seq("key"))))
1515
private val actorShardingClient =
16-
ActorShardingAPIControllerGen.withClient(new FakeRequestClient(), Some(Map("Authorization" -> Seq("key"))))
16+
ActorShardingAPIControllerGen.withClientAndHeaders(
17+
new FakeRequestClient(),
18+
Some(Map("Authorization" -> Seq("key")))
19+
)
1720

1821
/** —————————————————————— */
1922
/** ACTORSCONTROLLER */

test/controllers/CompaniesControllerTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import testutils.FakeRequestClient
77
import de.innfactory.smithy4play.client.SmithyPlayTestUtils._
88

99
class CompaniesControllerTest extends PlaySpec with BaseOneAppPerSuite with TestApplicationFactory {
10-
private val companyAdminCompanyClient = CompanyAPIControllerGen.withClient(
10+
private val companyAdminCompanyClient = CompanyAPIControllerGen.withClientAndHeaders(
1111
new FakeRequestClient(),
1212
Some(Map("Authorization" -> Seq(authUtils.CompanyAdminEmailToken)))
1313
)

test/controllers/HealthControllerTest.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ class HealthControllerTest extends PlaySpec with BaseOneAppPerSuite with TestApp
1414
/** ————————————————— */
1515
"HealthController" should {
1616
"accept GET request on base path" in {
17-
val result = publicClient.ping().awaitRight
17+
val result = publicClient.ping().run(None).awaitRight
1818
result.statusCode mustBe result.expectedStatusCode
1919
}
2020
"accept GET request on liveness check path" in {
21-
val result = publicClient.liveness().awaitRight
21+
val result = publicClient.liveness().run(None).awaitRight
2222
result.statusCode mustBe result.expectedStatusCode
2323
}
2424
"accept GET request on readiness check path" in {
25-
val result = publicClient.readiness().awaitRight
25+
val result = publicClient.readiness().run(None).awaitRight
2626
result.statusCode mustBe result.expectedStatusCode
2727
}
2828
}

test/controllers/LocationsControllerTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import de.innfactory.smithy4play.client.SmithyPlayTestUtils._
77
import testutils.FakeRequestClient
88

99
class LocationsControllerTest extends PlaySpec with BaseOneAppPerSuite with TestApplicationFactory {
10-
private val companyAdminLocationClient = LocationAPIControllerGen.withClient(
10+
private val companyAdminLocationClient = LocationAPIControllerGen.withClientAndHeaders(
1111
new FakeRequestClient(),
1212
Some(Map("Authorization" -> Seq(authUtils.CompanyAdminEmailToken)))
1313
)

0 commit comments

Comments
 (0)