diff --git a/build.sbt b/build.sbt index 71ee9e8..f12d0bc 100644 --- a/build.sbt +++ b/build.sbt @@ -5,10 +5,8 @@ inThisBuild( lazy val api = project.in(file("modules/api")) .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "cats-core" % "2.10.0", "com.softwaremill.sttp.tapir" %% "tapir-core" % "1.8.5", "com.softwaremill.sttp.tapir" %% "tapir-iron" % "1.8.5", "io.github.iltotore" %% "iron" % "2.3.0", - "io.github.iltotore" %% "iron-cats" % "2.3.0", ) ) diff --git a/modules/api/src/main/scala/types.scala b/modules/api/src/main/scala/types.scala index e5bf7ad..1c69da0 100644 --- a/modules/api/src/main/scala/types.scala +++ b/modules/api/src/main/scala/types.scala @@ -1,14 +1,11 @@ -import cats.Show -import cats.syntax.all.* import io.github.iltotore.iron.* import io.github.iltotore.iron.constraint.all.* -import sttp.tapir import sttp.tapir.Codec.PlainCodec +import sttp.tapir.DecodeResult import sttp.tapir.codec.iron.TapirCodecIron -import sttp.tapir.{CodecFormat, DecodeResult, Codec as TapirCodec, Schema as TapirSchema} private type VersionConstraints = DescribedAs[GreaterEqual[0], "Version must be positive"] opaque type Version = Int :| VersionConstraints object Version extends RefinedTypeOps[Int, VersionConstraints, Version] with TapirCodecIron: - given PlainCodec[Version] = summon[PlainCodec[Int]].mapDecode(s => DecodeResult.fromEitherString(s.show, either(s)))(_.value) + given PlainCodec[Version] = summon[PlainCodec[Int]].mapDecode(s => DecodeResult.fromEitherString(s.toString, either(s)))(_.value)