From 3e53e20b3b56bc259191cf78d0e59e2cd694e43a Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 4 Nov 2023 11:43:19 +0100 Subject: [PATCH] further simplications... --- modules/api/src/main/scala/types.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/api/src/main/scala/types.scala b/modules/api/src/main/scala/types.scala index b7518a6..2365886 100644 --- a/modules/api/src/main/scala/types.scala +++ b/modules/api/src/main/scala/types.scala @@ -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)