Builds Circe codecs out of JSON schema definitions.

API documentation

The JsonSchemas interpreter fixes the JsonSchema[A] to a type that provides both an io.circe.Encoder[A] and an io.circe.Decoder[A].

Given the following type definition:

sealed trait Shape
case class Circle(radius: Double) extends Shape
case class Rectangle(width: Double, height: Double) extends Shape

Assuming that there is an implicit JsonSchema[Shape] definition, we can encode a Shape into JSON and decode it using the usual circe operations:

import JsonSchema._
val shape: Shape = Circle(42)
val shapeJson: Json = shape.asJson
val maybeShape: Either[circe.Error, Shape] =[Shape]