aboutsummaryrefslogtreecommitdiff
path: root/jvm/src/main/scala/xyz/driver/core/json.scala
blob: ca5a47b34d2612672e14f08312e24b1f4e667553 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package xyz.driver.core

import akka.http.scaladsl.unmarshalling.Unmarshaller
import enumeratum._

@deprecated(
  "Using static JSON formats from singleton objects can require to many wildcard imports. It is " +
    "recommended to stack format traits into a single protocol.",
  "driver-core 1.11.5"
)
object json extends CoreJsonFormats with rest.Unmarshallers with rest.PathMatchers { self =>

  object enumeratum {
    def enumUnmarshaller[T <: EnumEntry](enum: Enum[T]): Unmarshaller[String, T] =
      rest.Directives.enumUnmarshaller(enum)
    type HasJsonFormat[T <: EnumEntry]  = self.HasJsonFormat[T]
    type EnumJsonFormat[T <: EnumEntry] = self.EnumJsonFormat[T]
  }

}