Skip to content

Commit

Permalink
Merge branch 'main' into update/sbt-scala3-migrate-0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
scala-steward committed Sep 24, 2023
2 parents f52ea85 + 70aabfc commit e219474
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 249 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ lazy val zioHttpBenchmarks = (project in file("zio-http-benchmarks"))
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "1.5.1",
"com.softwaremill.sttp.client3" %% "core" % "3.9.0",
// "dev.zio" %% "zio-interop-cats" % "3.3.0",
"org.slf4j" % "slf4j-api" % "2.0.7",
"org.slf4j" % "slf4j-simple" % "2.0.7",
"org.slf4j" % "slf4j-api" % "2.0.9",
"org.slf4j" % "slf4j-simple" % "2.0.9",
),
)
.dependsOn(zioHttp)
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Dependencies {
val NettyVersion = "4.1.93.Final"
val NettyIncubatorVersion = "0.0.20.Final"
val ScalaCompactCollectionVersion = "2.11.0"
val ZioVersion = "2.0.16"
val ZioVersion = "2.0.17"
val ZioCliVersion = "0.5.0"
val ZioSchemaVersion = "0.4.13"
val SttpVersion = "3.3.18"
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.4")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.15.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.16.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scala3-migrate" % "0.5.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.3.10")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object EndpointGen {
List(transformOrFail, withDoc, withExamples).map(_.asInstanceOf[Mapper[CliReprOf[Codec[_]], Any]])

def transformOrFail[A] = Mapper[CliReprOf[Codec[A]], Any](
(repr, _: Any) => CliRepr(repr.value.transform((x: A) => x, (x: A) => x), repr.repr),
(repr, _: Any) => CliRepr(repr.value.transform((x: A) => x)((x: A) => x), repr.repr),
Gen.empty,
)

Expand Down
13 changes: 6 additions & 7 deletions zio-http/src/main/scala/zio/http/codec/HeaderCodecs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private[codec] trait HeaderCodecs {

def header(headerType: HeaderType): HeaderCodec[headerType.HeaderValue] =
headerCodec(headerType.name, TextCodec.string)
.transformOrFailLeft(headerType.parse(_), headerType.render(_))
.transformOrFailLeft(headerType.parse(_))(headerType.render(_))

def name[A](name: String)(implicit codec: TextCodec[A]): HeaderCodec[A] =
headerCodec(name, codec)
Expand All @@ -39,20 +39,19 @@ private[codec] trait HeaderCodecs {
parse: B => A,
render: A => B,
)(implicit codec: TextCodec[B]): HeaderCodec[A] =
headerCodec(name, codec).transformOrFailLeft(
s => Try(parse(s)).toEither.left.map(e => s"Failed to parse header $name: ${e.getMessage}"),
render,
)
headerCodec(name, codec).transformOrFailLeft(s =>
Try(parse(s)).toEither.left.map(e => s"Failed to parse header $name: ${e.getMessage}"),
)(render)

def nameTransformOption[A, B](name: String, parse: B => Option[A], render: A => B)(implicit
codec: TextCodec[B],
): HeaderCodec[A] =
headerCodec(name, codec).transformOrFailLeft(parse(_).toRight(s"Failed to parse header $name"), render)
headerCodec(name, codec).transformOrFailLeft(parse(_).toRight(s"Failed to parse header $name"))(render)

def nameTransformOrFail[A, B](name: String, parse: B => Either[String, A], render: A => B)(implicit
codec: TextCodec[B],
): HeaderCodec[A] =
headerCodec(name, codec).transformOrFailLeft(parse, render)
headerCodec(name, codec).transformOrFailLeft(parse)(render)

final val accept: HeaderCodec[Header.Accept] = header(Header.Accept)
final val acceptEncoding: HeaderCodec[Header.AcceptEncoding] = header(Header.AcceptEncoding)
Expand Down
Loading

0 comments on commit e219474

Please sign in to comment.