Skip to content
Pre-release
Pre-release

@travisbrown travisbrown released this May 1, 2017 · 924 commits to master since this release

This release (candidate) includes contributions by 25 people, which I believe is a record for the project—thanks to all of you, and especially the 15 or 16 first-time contributors.

There are a couple of reasons this is a release candidate instead of a release. The first is that I'd like to give 2.12 users a chance to kick the tires on the fix for generic derivation for case classes with tagged members (#617). I'd also like to give all users one more chance to complain about the removal of the implicit default configuration in circe-generic-extras (#597), the new, more verbose encoding for scodec's BitVector (#551), etc.

If no bugs turn up and nobody complains loudly enough, I'll publish this release as 0.8.0 next Saturday (7 May 2017).

Bug fixes

This release fixes a bug reported by @felher (#604) that resulted in generic derivation failures on Scala 2.12 for case classes with members tagged with Shapeless's @@ (and presumably other similar mechanisms). The difference in 2.12 was due to a change in the behavior of the Scala reflection API's RefinedType extractor, which is accommodated in #617.

Cyril Ponomaryov fixed a bug (reported by Giovanni Caporaletti in #578) that could result in spurious decoding failures when using custom decoders for Option that are constructed with emap.

Michael Sitko fixed a bug in circe-scodec (reported by Daniel Urban in #551) that resulted in bit vectors not being round-trippable because the encoding right-padded the bits to the next byte boundary. We considered adding a header to the encoding to indicate the length, but decided on a more verbose JSON object encoding that specifies the length in a separate field (primarily to avoid confusion that could result when accidentally attempting to decode a BitVector as a ByteVector). If you need a more concise string representation, please use ByteVector instead of BitVector.

This release also includes fixes for three number-related bugs that were backported to 0.7 for the 0.7.1 release.

Additions

Alberto Paro has added an experimental @JsonKey annotation to circe-generic-extras to help with the common use case where individual fields need to be renamed in a way that isn't necessarily systematic (e.g. camel-case to snake-case):

scala> import io.circe.generic.extras._, io.circe.generic.extras.defaults._, io.circe.syntax._
import io.circe.generic.extras._
import io.circe.generic.extras.defaults._
import io.circe.syntax._

scala> @ConfiguredJsonCodec case class Bar(@JsonKey("my-int") i: Int, s: String)
defined class Bar
defined object Bar

scala> Bar(13, "Qux").asJson.noSpaces
res0: String = {"my-int":13,"s":"Qux"}

This annotation is somewhat at odds with the circe design guidelines, but the circe-generic-extras module is explicitly intended to be a space for experimentation, and if there's evidence that @JsonKey is useful and that people want it, it could someday be promoted to circe-generic.

The circe-java8 module is now available for Scala.js, thanks to Carlos Quiroz's scala-java-time library and integration by Olli Helenius (#560). Note that this dependency is not necessary for the JVM version of the module, and that it may eventually be dropped for Scala.js (if java.time is supported more directly at some point).

Removals

The circe-generic-extras module no longer provides a default implicit configuration (#597). Users must now provide an instance anywhere they use generically derived codecs, either by defining their own or adding this (new) import:

import io.circe.generic.extras.defaults._

I personally see this change as potentially controversial, but nobody complained when it was proposed (and implemented) by Simon Hafner, and I can see the argument for more explicitness in this respect. The circe-generic-extras module should still be considered experimental, though, and the default instance may be reinstated in a future release.

Other changes

As always thanks to all contributors, bug reporters, question askers, etc.!

Assets 2
You can’t perform that action at this time.