diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..29e4421 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Scala Steward: Reformat with scalafmt 3.7.17 +5b005b6fb96c9a9b2d0481da9f82b766364a1d03 diff --git a/.scalafmt.conf b/.scalafmt.conf index ee7753a..0c532c8 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,2 +1,2 @@ -version = "3.7.15" +version = "3.7.17" runner.dialect = scala213 \ No newline at end of file diff --git a/project/ConfigAxis.scala b/project/ConfigAxis.scala index b4dddc6..9e44b2d 100644 --- a/project/ConfigAxis.scala +++ b/project/ConfigAxis.scala @@ -1,6 +1,7 @@ import sbt.{VirtualAxis, *} -case class ConfigAxis(idSuffix: String, directorySuffix: String) extends VirtualAxis.StrongAxis {} +case class ConfigAxis(idSuffix: String, directorySuffix: String) + extends VirtualAxis.StrongAxis {} object ConfigAxis { diff --git a/src/main/scala/akka/http/scaladsl/marshallers/playjson/PlayJsonSupport.scala b/src/main/scala/akka/http/scaladsl/marshallers/playjson/PlayJsonSupport.scala index 577baaa..4c6f3a0 100644 --- a/src/main/scala/akka/http/scaladsl/marshallers/playjson/PlayJsonSupport.scala +++ b/src/main/scala/akka/http/scaladsl/marshallers/playjson/PlayJsonSupport.scala @@ -8,8 +8,8 @@ import akka.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller} import akka.util.ByteString import play.api.libs.json._ -/** - * Automatic to and from JSON marshalling/unmarshalling using an in-scope *play-json* protocol. +/** Automatic to and from JSON marshalling/unmarshalling using an in-scope + * *play-json* protocol. */ trait PlayJsonSupport { import PlayJsonSupport._ @@ -32,35 +32,51 @@ trait PlayJsonSupport { * But sometimes we have bugs most likely because of https://bugzilla.mozilla.org/show_bug.cgi?id=741776 */ - Marshaller.withFixedContentType(`application/json`) {HttpEntity(`application/json; charset=UTF-8`, _)} + Marshaller.withFixedContentType(`application/json`) { + HttpEntity(`application/json; charset=UTF-8`, _) + } } - /** - * HTTP entity => `A` + /** HTTP entity => `A` * - * @param reads reader for `A` - * @tparam A type to decode - * @return unmarshaller for `A` + * @param reads + * reader for `A` + * @tparam A + * type to decode + * @return + * unmarshaller for `A` */ - implicit def playJsonUnmarshaller[A](implicit reads: Reads[A]): FromEntityUnmarshaller[A] = { + implicit def playJsonUnmarshaller[A](implicit + reads: Reads[A] + ): FromEntityUnmarshaller[A] = { def read(json: JsValue) = reads.reads(json) recoverTotal { error => - throw RejectionError(ValidationRejection(JsError.toJson(error).toString, Some(PlayJsonError(error)))) + throw RejectionError( + ValidationRejection( + JsError.toJson(error).toString, + Some(PlayJsonError(error)) + ) + ) } jsonStringUnmarshaller.map(data => read(Json.parse(data))) } - /** - * `A` => HTTP entity + /** `A` => HTTP entity * - * @param writes writer for `A` - * @param printer output generation function, default to `stringify`, could be overridden with `Json.prettyPrint` - * @tparam A type to encode - * @return marshaller for any `A` value + * @param writes + * writer for `A` + * @param printer + * output generation function, default to `stringify`, could be overridden + * with `Json.prettyPrint` + * @tparam A + * type to encode + * @return + * marshaller for any `A` value */ implicit def playJsonMarshaller[A](implicit - writes: Writes[A], - printer: JsValue => String = Json.stringify): ToEntityMarshaller[A] = { + writes: Writes[A], + printer: JsValue => String = Json.stringify + ): ToEntityMarshaller[A] = { jsonStringMarshaller.compose(printer).compose(writes.writes) } @@ -69,9 +85,12 @@ trait PlayJsonSupport { object PlayJsonSupport extends PlayJsonSupport { val `application/json; charset=UTF-8`: ContentType.WithCharset = - MediaType.customWithOpenCharset("application", "json") withCharset HttpCharsets.`UTF-8` + MediaType.customWithOpenCharset( + "application", + "json" + ) withCharset HttpCharsets.`UTF-8` case class PlayJsonError(error: JsError) extends RuntimeException { override def getMessage: String = JsError.toJson(error).toString() } -} \ No newline at end of file +}