From 54b15dae509212f6661dc1f1bc4ca248cb487443 Mon Sep 17 00:00:00 2001 From: Kseniya Tomskikh Date: Fri, 20 Oct 2017 16:25:04 +0700 Subject: PDSUI-2336 Deleted api classes of play format, userhistory and message services --- .../serialization/PlayJsonSupport.scala | 34 ---------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/main/scala/xyz/driver/pdsuicommon/serialization/PlayJsonSupport.scala (limited to 'src/main/scala/xyz/driver/pdsuicommon/serialization') diff --git a/src/main/scala/xyz/driver/pdsuicommon/serialization/PlayJsonSupport.scala b/src/main/scala/xyz/driver/pdsuicommon/serialization/PlayJsonSupport.scala deleted file mode 100644 index 5158dab..0000000 --- a/src/main/scala/xyz/driver/pdsuicommon/serialization/PlayJsonSupport.scala +++ /dev/null @@ -1,34 +0,0 @@ -package xyz.driver.pdsuicommon.serialization - -import akka.http.scaladsl.server.{RejectionError, ValidationRejection} -import akka.http.scaladsl.unmarshalling.Unmarshaller -import play.api.libs.json.{Reads, Writes} -import play.api.libs.json.Json -import akka.http.scaladsl.marshalling.ToEntityMarshaller -import akka.http.scaladsl.unmarshalling.FromEntityUnmarshaller -import akka.http.scaladsl.model.MediaTypes.`application/json` - -trait PlayJsonSupport { - import akka.http.scaladsl.marshalling.Marshaller - - implicit def playJsonUnmarshaller[A: Reads]: FromEntityUnmarshaller[A] = { - val reads = implicitly[Reads[A]] - Unmarshaller.stringUnmarshaller - .forContentTypes(`application/json`) - .map(Json.parse) - .map(reads.reads) - .map(_.recoverTotal { error => - throw RejectionError(ValidationRejection(s"Error reading JSON response as ${reads}.")) - }) - } - - implicit def playJsonMarshaller[A: Writes]: ToEntityMarshaller[A] = { - Marshaller - .stringMarshaller(`application/json`) - .compose(Json.prettyPrint) - .compose(implicitly[Writes[A]].writes) - } - -} - -object PlayJsonSupport extends PlayJsonSupport -- cgit v1.2.3