Skip to content

Commit

Permalink
further simplications...
Browse files Browse the repository at this point in the history
  • Loading branch information
jnicoulaud-ledger committed Nov 4, 2023
1 parent d221891 commit 3e53e20
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/api/src/main/scala/types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import sttp.tapir.Codec.PlainCodec
import sttp.tapir.DecodeResult
import sttp.tapir.codec.iron.TapirCodecIron

type VersionConstraints = GreaterEqual[0]
opaque type Version = Int :| VersionConstraints
opaque type Version = Int :| GreaterEqual[0]

object Version extends RefinedTypeOps[Int, VersionConstraints, Version] with TapirCodecIron:
object Version extends RefinedTypeOps[Int, GreaterEqual[0], Version] with TapirCodecIron:
given PlainCodec[Version] = summon[PlainCodec[Int]].mapDecode(s => DecodeResult.fromEitherString(s.toString, either(s)))(_.value)

0 comments on commit 3e53e20

Please sign in to comment.