diff options
author | Jakob Odersky <jakob@driver.xyz> | 2018-07-02 17:03:48 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@driver.xyz> | 2018-07-02 17:03:48 -0700 |
commit | 3cbeeebb4ac166fefc08cc24a844301811605a36 (patch) | |
tree | 3f7cccbdbf76db5df999d636804636df7488a0fa /shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala | |
parent | eb52dfdefce35aa15523061e499065ee85659857 (diff) | |
download | driver-core-jo/scalajs.tar.gz driver-core-jo/scalajs.tar.bz2 driver-core-jo/scalajs.zip |
Formattingjo/scalajs
Diffstat (limited to 'shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala')
-rw-r--r-- | shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala b/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala index 68e741c..fd44162 100644 --- a/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala +++ b/shared/src/main/scala/xyz/driver/core/CoreJsonFormats.scala @@ -189,7 +189,7 @@ trait CoreJsonFormats extends DerivedJsonProtocol { override def write(value: T): JsValue = { map.find(_._2 == value).map(_._1) match { case Some(name) => JsString(name) - case _ => serializationError(s"Value $value is not found in the mapping $map") + case _ => serializationError(s"Value $value is not found in the mapping $map") } } @@ -205,7 +205,7 @@ trait CoreJsonFormats extends DerivedJsonProtocol { def read(json: JsValue): T = json match { case JsNumber(value) => create(value) - case _ => deserializationError(s"Expected number as ${typeOf[T].getClass.getName}, but got " + json.toString) + case _ => deserializationError(s"Expected number as ${typeOf[T].getClass.getName}, but got " + json.toString) } } @@ -288,7 +288,8 @@ trait CoreJsonFormats extends DerivedJsonProtocol { } } - implicit def nonEmptyNameFormat[T](implicit nonEmptyStringFormat: JsonFormat[Refined[String, NonEmpty]]): RootJsonFormat[NonEmptyName[T]] = + implicit def nonEmptyNameFormat[T]( + implicit nonEmptyStringFormat: JsonFormat[Refined[String, NonEmpty]]): RootJsonFormat[NonEmptyName[T]] = new RootJsonFormat[NonEmptyName[T]] { def write(name: NonEmptyName[T]) = JsString(name.value.value) @@ -318,4 +319,4 @@ trait CoreJsonFormats extends DerivedJsonProtocol { private[core] object CoreJsonFormats { def unrecognizedValue(value: String, possibleValues: Seq[Any]): Nothing = deserializationError(s"Unexpected value $value. Expected one of: ${possibleValues.mkString("[", ", ", "]")}") -}
\ No newline at end of file +} |