Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to latest Tapir version #1417

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ lazy val V = new {
// https://mvnrepository.com/artifact/io.circe/circe-core
val circe = "0.14.7"

val tapir = "1.6.4" // scala-steward:off // TODO "1.10.5"
val tapir = "1.11.7" // scala-steward:off // TODO "1.10.5"
val http4sBlaze = "0.23.15" // scala-steward:off // TODO "0.23.16"

val typesafeConfig = "1.4.3"
Expand Down Expand Up @@ -90,7 +90,7 @@ lazy val V = new {
// [error] org.hyperledger.identus.pollux.core.model.schema.CredentialSchemaSpec

val vaultDriver = "6.2.0"
val micrometer = "1.11.11"
val micrometer = "1.13.6"

val nimbusJwt = "9.37.3"
val keycloak = "23.0.7" // scala-steward:off //TODO 24.0.3 // update all quay.io/keycloak/keycloak
Expand All @@ -114,7 +114,10 @@ lazy val D = new {
val tapirPrometheusMetrics: ModuleID = "com.softwaremill.sttp.tapir" %% "tapir-prometheus-metrics" % V.tapir
val micrometer: ModuleID = "io.micrometer" % "micrometer-registry-prometheus" % V.micrometer
val micrometerPrometheusRegistry = "io.micrometer" % "micrometer-core" % V.micrometer
val scalaUri = "io.lemonlabs" %% "scala-uri" % V.scalaUri
val scalaUri = Seq(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bvoiturier, I think we need to find a replacement for this library.
It's not actively maintained and might cause conflicts as we upgrade other libraries.
https://github.com/lemonlabsuk/scala-uri

"io.lemonlabs" %% "scala-uri" % V.scalaUri exclude ("org.typelevel", "cats-parse_3"), // Exclude cats-parse to avoid deps conflict
"org.typelevel" % "cats-parse_3" % "1.0.0", // Replace with version 1.0.0
)

val zioConfig: ModuleID = "dev.zio" %% "zio-config" % V.zioConfig
val zioConfigMagnolia: ModuleID = "dev.zio" %% "zio-config-magnolia" % V.zioConfig
Expand Down Expand Up @@ -194,13 +197,12 @@ lazy val D_Shared = new {
D.zioConcurrent,
D.zioHttp,
D.zioKafka,
D.scalaUri,
D.zioPrelude,
// FIXME: split shared DB stuff as subproject?
D.doobieHikari,
D.doobiePostgres,
D.zioCatsInterop,
)
) ++ D.scalaUri
}

lazy val D_SharedJson = new {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class WebhookPublisher(
_ <- ZIO.logDebug(s"Sending event: $event to HTTP webhook URL: $url.")
url <- ZIO.fromEither(URL.decode(url)).orDie
response <- Client
.request(
.streaming(
Request(
url = url,
method = Method.POST,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.hyperledger.identus.agent.server

import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton
import io.micrometer.prometheus.{PrometheusConfig, PrometheusMeterRegistry}
import io.micrometer.prometheusmetrics.{PrometheusConfig, PrometheusMeterRegistry}
import org.hyperledger.identus.agent.server.config.AppConfig
import org.hyperledger.identus.agent.server.http.ZioHttpClient
import org.hyperledger.identus.agent.server.sql.Migrations as AgentMigrations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object CustomServerInterceptors {
)
)

def tapirDecodeFailureHandler: DecodeFailureHandler = (ctx: DecodeFailureContext) => {
def tapirDecodeFailureHandler[F[_]]: DecodeFailureHandler[F] = DecodeFailureHandler.pure[F](ctx => {

/** As per the Tapir Decode Failures documentation:
*
Expand Down Expand Up @@ -100,7 +100,7 @@ object CustomServerInterceptors {
)
)
case None => None
}
})

def http4sServiceErrorHandler: ServiceErrorHandler[Task] = (req: Request[Task]) => { case t: Throwable =>
val res = tapirDefectHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package org.hyperledger.identus.agent.server.http
import io.circe.*
import io.circe.generic.semiauto.*
import io.circe.syntax.*
import io.micrometer.prometheus.PrometheusMeterRegistry
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry
import org.http4s.*
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.server.Router
import org.hyperledger.identus.api.http.ErrorResponse
import org.hyperledger.identus.shared.crypto.Sha256Hash
import org.hyperledger.identus.shared.json.Json
import org.hyperledger.identus.system.controller.SystemEndpoints
import sttp.tapir.*
import sttp.tapir.model.ServerRequest
import sttp.tapir.server.http4s.ztapir.ZHttp4sServerInterpreter
import sttp.tapir.server.http4s.Http4sServerOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.hyperledger.identus.system.controller

import io.micrometer.prometheus.PrometheusMeterRegistry
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry
import org.hyperledger.identus.agent.server.buildinfo.BuildInfo
import org.hyperledger.identus.api.http.{ErrorResponse, RequestContext}
import org.hyperledger.identus.system.controller.http.HealthInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.hyperledger.identus.system.controller

import io.micrometer.prometheus.{PrometheusConfig, PrometheusMeterRegistry}
import org.hyperledger.identus.agent.server.config.AppConfig
import io.micrometer.prometheusmetrics.{PrometheusConfig, PrometheusMeterRegistry}
import org.hyperledger.identus.agent.server.http.CustomServerInterceptors
import org.hyperledger.identus.agent.server.SystemModule.configLayer
import org.hyperledger.identus.system.controller.http.HealthInfo
Expand Down
Loading