circe v0.12.0-M3 Release Notes
Release Date: 2019-06-12 // almost 5 years ago-
π This is a big release, with a lot of breaking changes and a few important warnings. It's likely these changes and warnings won't affect you, unless you're doing something really strange with the library, but please read the release notes anyway.
Highlights
Scala 2.13.0
π This milestone is the first circe release published for Scala 2.13! We had several open generic derivation issues that seem to have been resolved somehow in 2.13 (e.g. #881, #989), and generic derivation is much fasterβe.g. one of my standard test cases that compiled in around 70 seconds on 2.11 and 41 seconds on 2.12 consistently compiles in about 32 seconds on 2.13.
Codec
Codec
is here (#1151), after years of me saying I'd never add it. Together withderiveCodec
, andCodec.forProductN
. Among many other things, these additions mean that instead of this:import io.circe.{ Decoder, ObjectEncoder }, io.circe.generic.semiauto.\_case class Foo(a: String, b: List[Boolean], c: Double)object Foo { implicit val decodeFoo: Decoder[Foo] = deriveDecoder implicit val encodeFoo: ObjectEncoder[Foo] = deriveEncoder }
You can now write this:
import io.circe.Codec, io.circe.generic.semiauto.deriveCodeccase class Foo(a: String, b: List[Boolean], c: Double)object Foo { implicit val fooCodec: Codec[Foo] = deriveCodec }
π This change can cut your compile times almost in half if you're using semi-automatic generic derivation for a lot of case classes.
Codec
is also used by default by@JsonCodec
(unless you specifydecodeOnly
orencodeOnly
), so you might see benefits from this change without touching your code.Other new features
- π§ The configuration options for generic derivation in circe-generic-extras now include
strictDecoding
, which allows you to derive decoders that fail on unused JSON object fields (#1117, #1148). Thanks to Pablo Francisco PΓ©rez Hidalgo for adding this feature! - π Adrian Salajan added a parsing option to circe-jawn that allows you to specify that parsing should fail on JSON objects with duplicate keys (#1131, #1149).
π Bug fixes
- π§ Frederick Roth fixed a circe-generic-extras bug (#1142) that was introduced in the last milestone and that caused default values not to be used for null-valued fields even when the configuration says they should be (#1143).
- π I fixed a bug (#1063) that was reported by Andriy Plokhotnyuk that resulted in rounding when decoding JSON numbers to
Float
that differed from the rounding done byFloat.parseFloat
(#1160). - π I fixed a bug that's been around for a while (#941, #1078) that resulted in error accumulation being lost when decoding optional values (#1153).
Clean-up
π This release adds a bunch of stuff but still ends up being a net negative
1930 insertions(+), 2059 deletions(-)
, which is pretty cool. Here's what's gone:- π The entire circe-java8 project is gone (#1156, #1158). If you were using it and importing
io.circe.java8
, you can just stop doing these things, since thejava.time
instances are all now included in theEncoder
andDecoder
companion objects in the releases for all Scala versions (not just 2.12 and 2.13). - π
ObjectEncoder
(and some related types) have been deprecated and replaced byEncoder.AsObject
(#1150). In some cases these changes may break your code, but most users will just see deprecation warnings. - π I killed
AccumulatingDecoder
(#1155), since it never really accomplished what I intended, and I'm not sure that what I intended needed to be accomplished, anyway, and it confused a lot of people. Unless you were using it directly as a type class (which I tried to discourage), this removal shouldn't break your code, but you might get some deprecation warnings. - π I deprecated and renamed
enumDecoder
andenumEncoder
because I was tired of them being inconsistent with everything else (#1159).
β Warnings
- π Starting with this release, no modules of the library will work on Java 7 (see #1156 for why). Scala 2.12 requires Java 8, so this can only affect 2.11 users, and it will only affect 2.11 users who are still on a virtual machine that had public support EOL'd over four years ago. Hopefully this isn't you. If it is, you're stuck with 0.12.0-M2 or earlier releases.
- π Because the
java.time
instances are now included in circe-core for all Scala versions, and because Scala.js does not ship with a built-injava.time
implementation, and because scala-java-time is not yet released for Scala 2.13, we are not running tests for Scala.js on 2.13. If I cared enough about Scala.js I could publish scala-java-time locally for 2.13 in order to run these tests, or I could wait for the upcoming scala-java-time release, but I don't care enough about Scala.js. It's probably fine. - π As with 0.12.0-M1 and 0.12.0-M2, this is a milestone release, and it depends on milestone releases of Cats and other libraries. Please use with care (and report any issues you may run into).
The future
π This is still a milestone release mostly because it depends on Cats 2.0.0-M4, which is also a milestone release. I'll probably release an identical or very similar 0.12.0 shortly after Cats 2.0.0 is available.
- π§ The configuration options for generic derivation in circe-generic-extras now include