Skip to content

circe-generic-extras 0.13.1-M4

Pre-release
Pre-release
Compare
Choose a tag to compare
@travisbrown travisbrown released this 01 Mar 09:48
v0.13.1-M4
0ed4105

This milestone release introduces a new Decoder subtype that supports getting structured access to extraneous fields when withStrictDecoding is enabled.

For example:

import io.circe.generic.extras.{Configuration, ExtrasDecoder}
import io.circe.generic.extras.semiauto.deriveExtrasDecoder

case class Foo(a: Int, b: String, c: Option[Double])

object Foo {
  implicit val config: Configuration = Configuration.default.withStrictDecoding
  implicit val decodeFoo: ExtrasDecoder[Foo] = deriveExtrasDecoder
}

And then:

scala> import io.circe.literal._
import io.circe.literal._

scala> val doc = json"""{"a": 1, "x": null, "b": "", "c": 123.0, "other": []}"""
val doc: io.circe.Json =
{
  "a" : 1,
  "x" : null,
  "b" : "",
  "c" : 123.0,
  "other" : [
  ]
}

scala> val Left((_, extra)) = Foo.decodeFoo.decodeStrict(doc.hcursor)
val extra: List[String] = List(x, other)

See #125 for more details.

This release also updates the Scala.js version to 1.5.0. The JVM artifacts are verified by MiMa to be backwards binary-compatible with 0.13.0.