diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 1394554716..83720642c6 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -48,3 +48,6 @@ e003ec3b61e3bd582ae6a5200177fa6433099c09 # Scala Steward: Reformat with scalafmt 3.8.2 9b44bd1451b796259b0592afe54bb5891f63f48e + +# Scala Steward: Reformat with scalafmt 3.8.3 +d743a8c6f793a5b30c8f14cfd57a367a4ffee4cd diff --git a/.scalafmt.conf b/.scalafmt.conf index e08758e4ae..27ea3ab482 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.2 +version = 3.8.3 maxColumn = 140 runner.dialect = scala3 fileOverride { diff --git a/core/src/test/scala-3/sttp/tapir/EndpointScala3Test.scala b/core/src/test/scala-3/sttp/tapir/EndpointScala3Test.scala index fb148e558b..5c7bf64239 100644 --- a/core/src/test/scala-3/sttp/tapir/EndpointScala3Test.scala +++ b/core/src/test/scala-3/sttp/tapir/EndpointScala3Test.scala @@ -15,7 +15,7 @@ class EndpointScala3Test extends AnyFlatSpec with Matchers: ) ) } - + it should "compile when using parameterless sealed traits" in { endpoint.get .out( @@ -52,4 +52,4 @@ object EndpointScala3Test: sealed trait ParameterlessSealed object ParameterlessSealed: case object Case1 extends ParameterlessSealed - case object Case2 extends ParameterlessSealed \ No newline at end of file + case object Case2 extends ParameterlessSealed diff --git a/core/src/test/scala/sttp/tapir/SchemaTest.scala b/core/src/test/scala/sttp/tapir/SchemaTest.scala index e6709c6171..c016cb6765 100644 --- a/core/src/test/scala/sttp/tapir/SchemaTest.scala +++ b/core/src/test/scala/sttp/tapir/SchemaTest.scala @@ -209,13 +209,16 @@ class SchemaTest extends AnyFlatSpec with Matchers { it should "generate correct names for Eithers with parameterized types" in { import sttp.tapir.generic.auto._ - implicitly[Schema[Either[Int, Int]]].name shouldBe None + implicitly[Schema[Either[Int, Int]]].name shouldBe None implicitly[Schema[Either[SomeValueInt, Int]]].name shouldBe None implicitly[Schema[Either[SomeValueInt, SomeValueInt]]].name shouldBe Some( SName("Either", List("sttp.tapir.SchemaTest.SomeValueInt", "sttp.tapir.SchemaTest.SomeValueInt")) ) implicitly[Schema[Either[SomeValueInt, Node[SomeValueString[Boolean]]]]].name shouldBe Some( - SName("Either", List("sttp.tapir.SchemaTest.SomeValueInt", "sttp.tapir.SchemaTest.Node", "sttp.tapir.SchemaTest.SomeValueString", "scala.Boolean")) + SName( + "Either", + List("sttp.tapir.SchemaTest.SomeValueInt", "sttp.tapir.SchemaTest.Node", "sttp.tapir.SchemaTest.SomeValueString", "scala.Boolean") + ) ) implicitly[Schema[Either[SomeValueInt, Node[String]]]].name shouldBe Some( SName("Either", List("sttp.tapir.SchemaTest.SomeValueInt", "sttp.tapir.SchemaTest.Node", "java.lang.String")) @@ -224,15 +227,18 @@ class SchemaTest extends AnyFlatSpec with Matchers { SName("Either", List("sttp.tapir.SchemaTest.Node", "scala.Boolean", "sttp.tapir.SchemaTest.SomeValueInt")) ) } - + it should "generate correct names for Maps with parameterized types" in { import sttp.tapir.generic.auto._ type Tree[A] = Either[A, Node[A]] - val schema1: Schema[Map[SomeValueInt, Node[SomeValueString[Boolean]]]] = Schema.schemaForMap(_.toString) + val schema1: Schema[Map[SomeValueInt, Node[SomeValueString[Boolean]]]] = Schema.schemaForMap(_.toString) schema1.name shouldBe Some( - SName("Map", List("sttp.tapir.SchemaTest.SomeValueInt", "sttp.tapir.SchemaTest.Node", "sttp.tapir.SchemaTest.SomeValueString", "scala.Boolean")) + SName( + "Map", + List("sttp.tapir.SchemaTest.SomeValueInt", "sttp.tapir.SchemaTest.Node", "sttp.tapir.SchemaTest.SomeValueString", "scala.Boolean") + ) ) - val schema2: Schema[Map[Node[Boolean], Node[String]]] = Schema.schemaForMap(_.toString) + val schema2: Schema[Map[Node[Boolean], Node[String]]] = Schema.schemaForMap(_.toString) schema2.name shouldBe Some( SName("Map", List("sttp.tapir.SchemaTest.Node", "scala.Boolean", "sttp.tapir.SchemaTest.Node", "java.lang.String")) ) diff --git a/docs/asyncapi-docs/src/main/scala/sttp/tapir/docs/asyncapi/ExampleConverter.scala b/docs/asyncapi-docs/src/main/scala/sttp/tapir/docs/asyncapi/ExampleConverter.scala index 6d14a520e5..d795902ed3 100644 --- a/docs/asyncapi-docs/src/main/scala/sttp/tapir/docs/asyncapi/ExampleConverter.scala +++ b/docs/asyncapi-docs/src/main/scala/sttp/tapir/docs/asyncapi/ExampleConverter.scala @@ -13,7 +13,7 @@ private[asyncapi] object ExampleConverter { case WebSocketFrame.Text(payload, _, _) => Some(MessageExample(headers = None, Some(ExampleSingleValue(payload)), example.name, example.summary)) case WebSocketFrame.Binary(_, _, _) => None - case _: WebSocketFrame.Control => None + case _: WebSocketFrame.Control => None } } } diff --git a/integrations/iron/src/main/scala/sttp/iron/codec/iron/IntersectionTypeMirror.scala b/integrations/iron/src/main/scala/sttp/iron/codec/iron/IntersectionTypeMirror.scala index 74ea27ffeb..71c18a1997 100644 --- a/integrations/iron/src/main/scala/sttp/iron/codec/iron/IntersectionTypeMirror.scala +++ b/integrations/iron/src/main/scala/sttp/iron/codec/iron/IntersectionTypeMirror.scala @@ -34,9 +34,9 @@ object IntersectionTypeMirror { tpe.dealias match case AndType(left, right) => concatTypes(rec(left), rec(right)) case t => - // Intentionally using `tpe` instead of `t`. Dealiased representation `t` "loses" information - // about the original type from the intersection. For example, an Iron predicate `MinLength[N]` - // would be dealiased to `DescribedAs[Length[GreaterEqual[N]], _]`. + // Intentionally using `tpe` instead of `t`. Dealiased representation `t` "loses" information + // about the original type from the intersection. For example, an Iron predicate `MinLength[N]` + // would be dealiased to `DescribedAs[Length[GreaterEqual[N]], _]`. // Then, a given `ValidatorForPredicate[T, MinLength[N]]` would not be used in implicit resolution. prependTypes(tpe, TypeRepr.of[EmptyTuple]) } diff --git a/integrations/iron/src/main/scala/sttp/iron/codec/iron/UnionTypeMirror.scala b/integrations/iron/src/main/scala/sttp/iron/codec/iron/UnionTypeMirror.scala index db6e6b8f77..7d7a61d99e 100644 --- a/integrations/iron/src/main/scala/sttp/iron/codec/iron/UnionTypeMirror.scala +++ b/integrations/iron/src/main/scala/sttp/iron/codec/iron/UnionTypeMirror.scala @@ -39,10 +39,10 @@ object UnionTypeMirror { val (c1, rec1) = rec(left) val (c2, rec2) = rec(right) (c1 + c2, concatTypes(rec1, rec2)) - case t => - // Intentionally using `tpe` instead of `t`. Dealiased representation `t` "loses" information - // about the original type from the union. For example, an Iron predicate `MinLength[N]` - // would be dealiased to `DescribedAs[Length[GreaterEqual[N]], _]`. + case t => + // Intentionally using `tpe` instead of `t`. Dealiased representation `t` "loses" information + // about the original type from the union. For example, an Iron predicate `MinLength[N]` + // would be dealiased to `DescribedAs[Length[GreaterEqual[N]], _]`. // Then, a given `ValidatorForPredicate[T, MinLength[N]]` would not be used in implicit resolution. (1, prependTypes(tpe, TypeRepr.of[EmptyTuple])) } diff --git a/json/jsoniter/src/test/scala/sttp/tapir/json/jsoniter/TapirJsonJsoniterTests.scala b/json/jsoniter/src/test/scala/sttp/tapir/json/jsoniter/TapirJsonJsoniterTests.scala index 9953cb749d..cbe73af8f0 100644 --- a/json/jsoniter/src/test/scala/sttp/tapir/json/jsoniter/TapirJsonJsoniterTests.scala +++ b/json/jsoniter/src/test/scala/sttp/tapir/json/jsoniter/TapirJsonJsoniterTests.scala @@ -32,7 +32,7 @@ class TapirJsonJsoniterTests extends AnyFlatSpecLike with Matchers { val error = failure.error.asInstanceOf[JsonDecodeException] error.errors shouldEqual List(JsonError("missing required field \"name\", offset: 0x00000001", Nil)) tapirCodecWithHexDump.decode("{}") should matchPattern { - case DecodeResult.Error(_, JsonDecodeException(errs, _: JsonReaderException)) if errs.head.msg.contains("buf:") => + case DecodeResult.Error(_, JsonDecodeException(errs, _: JsonReaderException)) if errs.head.msg.contains("buf:") => } error.underlying shouldBe a[JsonReaderException] } diff --git a/server/finatra-server/src/main/scala/sttp/tapir/server/finatra/FinatraServerInterpreter.scala b/server/finatra-server/src/main/scala/sttp/tapir/server/finatra/FinatraServerInterpreter.scala index 6d17baece9..712f32177d 100644 --- a/server/finatra-server/src/main/scala/sttp/tapir/server/finatra/FinatraServerInterpreter.scala +++ b/server/finatra-server/src/main/scala/sttp/tapir/server/finatra/FinatraServerInterpreter.scala @@ -62,14 +62,12 @@ trait FinatraServerInterpreter extends Logging { private[finatra] def path(input: EndpointInput[_]): String = { val basicInputs = input.asVectorOfBasicInputs() - val p = basicInputs - .collect { - case segment: EndpointInput.FixedPath[_] => segment.show - case PathCapture(Some(name), _, _) => s"/:$name" - case PathCapture(_, _, _) => "/:param" - case EndpointInput.PathsCapture(_, _) => "/:*" - } - .mkString + val p = basicInputs.collect { + case segment: EndpointInput.FixedPath[_] => segment.show + case PathCapture(Some(name), _, _) => s"/:$name" + case PathCapture(_, _, _) => "/:param" + case EndpointInput.PathsCapture(_, _) => "/:*" + }.mkString if (p.isEmpty) "/:*" // checking if there's an input which rejects trailing slashes; otherwise the default behavior is to accept them else if ( diff --git a/server/http4s-server/zio/src/test/scala/sttp/tapir/server/http4s/ztapir/ZHttp4sTestServerInterpreter.scala b/server/http4s-server/zio/src/test/scala/sttp/tapir/server/http4s/ztapir/ZHttp4sTestServerInterpreter.scala index 04fb08dd45..9b46b6a198 100644 --- a/server/http4s-server/zio/src/test/scala/sttp/tapir/server/http4s/ztapir/ZHttp4sTestServerInterpreter.scala +++ b/server/http4s-server/zio/src/test/scala/sttp/tapir/server/http4s/ztapir/ZHttp4sTestServerInterpreter.scala @@ -47,7 +47,7 @@ class ZHttp4sTestServerInterpreter extends TestServerInterpreter[Task, ZioStream .withHttpWebSocketApp(service) .resource .map(_.address.getPort) - .mapK(new ~>[Task, IO] { + .mapK(new ~>[Task, IO] { // Converting a ZIO effect to an Cats Effect IO effect def apply[B](fa: Task[B]): IO[B] = IO.fromFuture(Unsafe.unsafe(implicit u => IO(Runtime.default.unsafe.runToFuture(fa)))) }) diff --git a/server/tests/src/main/scala/sttp/tapir/server/tests/ServerOneOfTests.scala b/server/tests/src/main/scala/sttp/tapir/server/tests/ServerOneOfTests.scala index 1ac47824b9..e8271f28b8 100644 --- a/server/tests/src/main/scala/sttp/tapir/server/tests/ServerOneOfTests.scala +++ b/server/tests/src/main/scala/sttp/tapir/server/tests/ServerOneOfTests.scala @@ -174,6 +174,6 @@ class ServerOneOfTests[F[_], OPTIONS, ROUTE]( (backend, baseUri) => basicRequest.get(uri"$baseUri/mapping?num=1").send(backend).map(_.code shouldBe StatusCode.Ok) >> basicRequest.get(uri"$baseUri/mapping?num=2").send(backend).map(_.code shouldBe StatusCode.Accepted) - }, + } ) } diff --git a/server/zio-http-server/src/main/scala/sttp/tapir/server/ziohttp/ZioHttpInterpreter.scala b/server/zio-http-server/src/main/scala/sttp/tapir/server/ziohttp/ZioHttpInterpreter.scala index 578ef43beb..b9db565d7c 100644 --- a/server/zio-http-server/src/main/scala/sttp/tapir/server/ziohttp/ZioHttpInterpreter.scala +++ b/server/zio-http-server/src/main/scala/sttp/tapir/server/ziohttp/ZioHttpInterpreter.scala @@ -70,8 +70,8 @@ trait ZioHttpInterpreter[R] { val e = se.endpoint val inputs = e.securityInput.and(e.input).asVectorOfBasicInputs() - // Creating the path template - no-trailing-slash inputs are treated as wildcard inputs, as they are usually - // accompanied by endpoints which handle wildcard path inputs, when the `/` is present (to serve files). They + // Creating the path template - no-trailing-slash inputs are treated as wildcard inputs, as they are usually + // accompanied by endpoints which handle wildcard path inputs, when the `/` is present (to serve files). They // need to end up in the same group (see below), so that they are disambiguated by tapir's logic. val pathTemplate = inputs.foldLeft("") { case (p, component) => component match { @@ -120,7 +120,7 @@ trait ZioHttpInterpreter[R] { // Grouping the endpoints by path template. This way, if there are multiple endpoints with/without trailing slash or // with path wildcards, they will end up in the same group, and they will be disambiguated by the tapir logic. - // That's because there's not way currently to create a zio-http route pattern which would match on + // That's because there's not way currently to create a zio-http route pattern which would match on // no-trailing-slashes. A group also includes multiple endpoints with different methods, but same path. val widenedSesGroupedByPathPrefixTemplate = widenedSes.zipWithIndex .map { case (se, index) => toPattern(se, index) }