diff --git a/build.sbt b/build.sbt index c426ab32..2903e33b 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ import sbt.Compile import sbt.Keys.cleanFiles -val releaseVersion = sys.env.getOrElse("TAG", "0.2.3-BETA.6") +val releaseVersion = sys.env.getOrElse("TAG", "0.4.4-Delta") addCommandAlias("publishSmithy4Play", "smithy4play/publish") addCommandAlias("publishLocalSmithy4Play", "smithy4play/publishLocal") addCommandAlias("generateCoverage", "clean; coverage; test; coverageReport") diff --git a/smithy4play/src/main/scala/de/innfactory/smithy4play/package.scala b/smithy4play/src/main/scala/de/innfactory/smithy4play/package.scala index f69906db..99c6eb7a 100644 --- a/smithy4play/src/main/scala/de/innfactory/smithy4play/package.scala +++ b/smithy4play/src/main/scala/de/innfactory/smithy4play/package.scala @@ -14,7 +14,7 @@ import scala.language.experimental.macros package object smithy4play { - trait ContextRouteError extends StatusResult { + trait ContextRouteError extends StatusResult[ContextRouteError] { def message: String def toJson: JsValue } @@ -24,9 +24,9 @@ package object smithy4play { type RouteResult[O] = EitherT[Future, ContextRouteError, O] type ContextRoute[O] = Kleisli[RouteResult, RoutingContext, O] - trait StatusResult extends Product { + trait StatusResult[S <: StatusResult[S]] { def status: Status - def addHeaders(headers: Map[String, String]): StatusResult + def addHeaders(headers: Map[String, String]): S } case class Status(headers: Map[String, String], statusCode: Int) @@ -34,7 +34,7 @@ package object smithy4play { implicit val format = Json.format[Status] } - case class EndpointResult(body: Option[Array[Byte]], status: Status) extends StatusResult { + case class EndpointResult(body: Option[Array[Byte]], status: Status) extends StatusResult[EndpointResult] { override def addHeaders(headers: Map[String, String]): EndpointResult = this.copy( status = status.copy( headers = status.headers ++ headers