All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.iltotore.iron.zioJson.scala Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package io.github.iltotore.iron

import zio.json.{JsonDecoder, JsonEncoder}

object zioJson:

  inline given [A, C](using inline decoder: JsonDecoder[A], constraint: Constraint[A, C]): JsonDecoder[A :| C] =
    decoder.mapOrFail(_.refineEither)

  inline given [A, C](using inline encoder: JsonEncoder[A]): JsonEncoder[A :| C] =
    encoder.asInstanceOf[JsonEncoder[A :| C]]

  inline given[T](using mirror: RefinedTypeOps.Mirror[T], ev: JsonDecoder[mirror.IronType]): JsonDecoder[T] =
    ev.asInstanceOf[JsonDecoder[T]]

  inline given[T](using mirror: RefinedTypeOps.Mirror[T], ev: JsonEncoder[mirror.IronType]): JsonEncoder[T] =
    ev.asInstanceOf[JsonEncoder[T]]




© 2015 - 2025 Weber Informatics LLC | Privacy Policy