Skip to content

Releases: circe/circe-derivation

circe-derivation 0.13.0-M5

23 Nov 09:36
v0.13.0-M5
626f2ac
Compare
Choose a tag to compare
Pre-release

This release includes numerous build and testing dependency updated, as well as #189 by @Hjdskes, which fixes issues with warnings on macro-generated code.

circe-derivation 0.13.0-M4

23 Mar 10:06
v0.13.0-M4
cd5d5f2
Compare
Choose a tag to compare
Pre-release

This release introduces deriveX overloads that allow you to specify only a name transformer if you want to use the defaults for using default values or a discriminator field (which are yes and no respectively). For example, instead of this:

implicit val codecForFoo: Codec.AsObject[Foo] = deriveCodec(renaming.snakeCase, true, None)

You can now write this:

implicit val codecForFoo: Codec.AsObject[Foo] = deriveCodec(renaming.snakeCase)

Thanks to @shrynx for adding this change in #187.

circe-derivation 0.13.0-M3

13 Mar 13:54
v0.13.0-M3
0785d9b
Compare
Choose a tag to compare
Pre-release

This release introduces support for transforming constructor names in derived instances for ADTs. Usage is the same as for transforming member names in derived instances for case classes:

import io.circe.Codec, io.circe.derivation.deriveCodec, io.circe.syntax._

sealed trait Base
case class Foo(i: Int, s: String) extends Base

object Base {
  implicit val codecForFoo: Codec.AsObject[Foo] = deriveCodec
  implicit val codecForBase: Codec.AsObject[Base] = deriveCodec(_.toLowerCase, true, Some("type"))
}

And then:

scala> (Foo(123, "abc"): Base).asJson
res0: io.circe.Json =
{
  "i" : 123,
  "s" : "abc",
  "type" : "foo"
}

Note that the type field is in lowercase instead of using the default "Foo". These transformations work for both the object wrapper and discriminator field encodings.

Thanks to @danxmoran for implementing this feature in #114. I made a few adjustments in #186.

This release also fixes a bug that caused derived ADT decoders not to preserve error accumulation. For example, take the following code:

import io.circe.Codec, io.circe.derivation.deriveCodec

sealed trait Base
case class Foo(i: Int, s: String) extends Base

object Base {
  implicit val codecForFoo: Codec.AsObject[Foo] = deriveCodec
  implicit val codecForBase: Codec.AsObject[Base] = deriveCodec

  val example = io.circe.jawn.decodeAccumulating[Base]("""{"Foo": {}}""")
}

With 0.13.0-M2 we only get one error:

scala> Base.example.swap.toOption.get.toList.foreach(println)
DecodingFailure(Attempt to decode value on failed cursor, List(DownField(i), DownField(Foo)))

While with this release we get both:

scala> Base.example.swap.toOption.get.toList.foreach(println)
DecodingFailure(Attempt to decode value on failed cursor, List(DownField(i), DownField(Foo)))
DecodingFailure(Attempt to decode value on failed cursor, List(DownField(s), DownField(Foo)))

This bug did not affect anyone who wasn't using derived instances to decode ADTs in error accumulation mode.

Like 0.13.0-M2 this release is published for Scala.js 1.0; unlike 0.13.0-M2 it is not also published for Scala.js 0.6.

circe-derivation 0.13.0-M2

02 Mar 15:54
bb08f1a
Compare
Choose a tag to compare
Pre-release

This release fixes two bugs related to decoding case classes with default values, one of which was introduced in 0.13.0-M1 (see #179 for details).

circe-derivation 0.13.0-M1

18 Feb 12:54
37e88c3
Compare
Choose a tag to compare
Pre-release

This release updates the Circe version to 0.13.0 and fixes a bug that involved decoding with default values to fail when the input contained a null-valued field (reported and fixed by @nolledge in #115 and #117).

circe-derivation 0.12.0-M7

13 Sep 07:30
Compare
Choose a tag to compare
Pre-release

This release updates the Cats version to 2.0.0 and the Circe version to 0.12.1. It also includes a fix by @neko-kai for a bug (#103) that caused constructor names in the JSON representation to be lower-cased (#104).

I'm planning to release a 0.12.0 of this library once #110 is fixed, but I'm unlikely to be able to get to that in the next few weeks, so if anyone wants to help I'd appreciate it.

circe-derivation 0.12.0-M6

30 Aug 10:24
Compare
Choose a tag to compare
Pre-release

This release updates the circe version from 0.12.0-RC1 to 0.12.0-RC2 (and Cats to 2.0.0-RC2), but it also includes the biggest set of new features since I started the project, thanks primarily to Alberto Paro in #91.

Derivation now works for ADTs as well as case classes, you can derive case class decoders that use default member values for missing fields, and the annotations now (almost) match the features supported by circe-generic-extras (the main missing piece is constructor name transformation for ADT codecs, which I'm hoping to add in the next release).

Note that while the library is reasonably well-tested, it is experimental, and writing macros is hard, so please use with care.

circe-derivation 0.12.0-M5

07 Aug 13:09
Compare
Choose a tag to compare
Pre-release

This release updates the circe version to 0.12.0-RC1 and Cats to 2.0.0-RC1. It also includes a couple of changes, including a fix for some spurious compilation warnings (#83) and a couple of new annotation aliases (#87).

circe-derivation 0.11.0-M3

07 Aug 12:32
Compare
Choose a tag to compare
Pre-release

This release backports #87 (which adds a couple of new alias annotations) for Circe 0.11.x.

circe-derivation 0.11.0-M2

07 Aug 09:32
Compare
Choose a tag to compare
Pre-release

This release backports #83 (which resolves some spurious compilation warnings) for Circe 0.11.x.