@travisbrown travisbrown released this Oct 30, 2018 · 31 commits to master since this release

Assets 2

This is a patch release that fixes one bug and adds a couple of features. It's verified by MiMa to be binary compatible with 0.10.0.

The number parsing bug

The bug was reported by Shira Smith and involves circe's number parsing:

scala> io.circe.numbers.BiggerDecimal.parseBiggerDecimal("-")
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
  at java.lang.String.charAt(String.java:658)
  at io.circe.numbers.BiggerDecimal$.parseBiggerDecimalUnsafe(BiggerDecimal.scala:250)
  at io.circe.numbers.BiggerDecimal$.parseBiggerDecimal(BiggerDecimal.scala:237)
  ... 36 elided

This would be bad enough, since we claim that no method in circe's public API will ever throw an exception, but to make matters worse you can actually run into this using plain old io.circe.jawn.decode, although only in a corner case (via the fallback behavior that tries to parse a JSON string when a number is expected):

scala> io.circe.jawn.decode[Int](""""-"""")
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
  at java.lang.String.charAt(String.java:658)
  at io.circe.numbers.BiggerDecimal$.parseBiggerDecimalUnsafe(BiggerDecimal.scala:250)
  at io.circe.JsonNumber$.fromString(JsonNumber.scala:223)
  at io.circe.Decoder$$anon$6.apply(Decoder.scala:626)
  at io.circe.Decoder.decodeJson(Decoder.scala:52)
  at io.circe.Decoder.decodeJson$(Decoder.scala:52)
  at io.circe.Decoder$DecoderWithFailure.decodeJson(Decoder.scala:320)
  at io.circe.Parser.finishDecode(Parser.scala:12)
  at io.circe.Parser.finishDecode$(Parser.scala:9)
  at io.circe.jawn.JawnParser.finishDecode(JawnParser.scala:9)
  at io.circe.Parser.decode(Parser.scala:26)
  at io.circe.Parser.decode$(Parser.scala:25)
  at io.circe.jawn.JawnParser.decode(JawnParser.scala:9)
  ... 36 elided

Which is pretty bad, so thanks much to Shira for catching and fixing this.

(For what it's worth, this bug has been around since circe 0.7.0-M1, which is nearing its second birthday, and as far as I know nobody else has run into it.)

Modifier support for macro annotations

I said above that this was a new feature, but to be honest the previous behavior should probably be considered a bug (fortunately in this case it's all compile-time stuff and I'm not too worried about how to categorize it). Michael Lampe noticed that the @JsonCodec annotation does not work with e.g. access modifiers on the annotated object, and provided a fix. So now you can write this:

package mypackage

import io.circe.generic.JsonCodec

@JsonCodec private[mypackage] final case class MyCaseClass(a: Int)
private[mypackage] object MyCaseClass { /* ... */ }

It also works with the @ConfiguredJsonCodec in generic-extras.

Time instance trait publicity

Adam Warski and others noted that the trait providing java.time instances is no longer public in 0.10.0, and Adam provided a fix, which means that if you had mixed the TimeInstances trait into a protocol object in earlier circe versions, you can now do the same with JavaTimeDecoders and JavaTimeEncoders. (Note that most people should not need to use the io.circe.java8 package at all, since these instances are now provided in implicit scope for Scala 2.12.)

@travisbrown travisbrown released this Sep 24, 2018 · 31 commits to master since this release

Assets 2

This release drops Scala 2.10 support and adds artifacts for 2.13.0-M4. It also updates many dependency versions, including Cats (from 1.0.1 in 0.9.x to 1.4.0), Scala.js (from 0.6.22 to 0.6.24), refined (from 0.8.7 to 0.9.2), and jawn (from 0.11.1 to 0.13.0).

Java 8 instances

The encoder and decoder instances for all java.time types have been moved into the circe-core JVM artifacts for Scala 2.12 and 2.13.0-M4 (since both of these Scala versions require Java 8, anyway). The circe-java8 artifacts are still published for all Scala versions and platforms, since you'll still need them if you're using Scala.js or Scala 2.11 and want these instances. Thanks to Guillaume Poirier for helping with this effort, and to Felix Bruckmeier for improving the failure messages for these instances.

Other additions

This release introduces encoder and decoder instances for Cats's new Chain and NonEmptyChain data structures, as well as instances for NonEmptyMap and NonEmptySet (all thanks to Diogo Castro). It also introduces a new ensure method for Decoder (thanks, @saint1991).

Bug fixes

Optimizations

Known issues

The Macro Paradise compiler plugin is not currently available for 2.13.0-M4, which means that @JsonCodec and the related annotations in circe-generic-extras will not work on 2.13. When (or if) the plugin is published for 2.13.0-M4 it should work as expected with this release. (See Seth Tisue's note here.)

Future plans

We'll probably publish 0.10.x releases for Scala 2.13.0-M5 if Cats publishes 1.4.x releases for it, but Scala.js 0.6.25+ (which is currently blocked by failures on 2.13.0-M4) will wait for 0.11.0, which is probably only a couple of months away.

Pre-release

@travisbrown travisbrown released this Aug 20, 2018 · 71 commits to master since this release

Assets 2

This release is the first that's cross-published for Scala 2.13 (specifically for 2.13.0-M4). It includes a couple of major organizational changes that specifically support the 2.13 release:

  • The circe-optics module is being split out into its own repository, which will live in the circe organization. I've been intending to make this move for a while, and the fact that Monocle doesn't yet have a 2.13 build means that it's convenient to do it now. I'm not planning to publish any circe-optics releases until circe 0.10.0 is out.
  • The circe-java8 module is also being split out into its own repository, but its functionality is now available in circe-core for all platforms that are guaranteed to support it. On the JVM, java.time instances are provided for 2.12 and 2.13, but not 2.11. On Scala.js, they are available for 2.12 only, since scala-java-time is not yet published for 2.13. Thanks to Guillaume Poirier for kicking off the work of moving these instances into circe-core last year (I wish it hadn't taken so long to get this merged).

I'm trying to avoid using scala-collection-compat, and instead there are a few small differences in the Decoder companion object across versions, with 2.11 and 2.12 using CanBuildFrom and 2.13 using the new Factory type class.

Many dependency versions have also been bumped, including Cats (to 1.2.0), Jawn (to 0.13.0), and Scala.js (to 0.6.23).

Note that at the time that I'm writing this, the Macro Paradise compiler plugin is not available for 2.13.0-M4. This means that @JsonCodec and the related annotations in circe-generic-extras will not work on 2.13 at the moment, but once the plugin is published for 2.13.0-M4 it should work as expected with this release.

Please use with care! This is a milestone release that introduces an artifact built with a milestone version of the Scala compiler. If you don't want to have to worry about running into weird bugs, please choose 0.9.3 instead, but if you don't mind a little risk, I would very much appreciate any feedback about the experience of using this release on 2.13.0-M4.

Pre-release

@travisbrown travisbrown released this Apr 24, 2018 · 135 commits to master since this release

Assets 2

This milestone release bumps several dependency versions, including Cats (from 1.0.1 to 1.1.0), Jawn (from 0.11.1 to 0.12.1), refined (from 0.8.7 to 0.9.0), and Monocle (from 1.5.0 to 1.5.1-cats).

It includes a few other changes, including the following:

  • A fix for a bug involving optional fields and stateful decoding (#708) by Jonas Adler (#880).
  • A fix for a bug involving an inconsistency in the behavior of optional decoders by Hugh Giddens (#851).
  • An optimization for name transformations in circe-generic-extras by vndzzz (#860).
  • Support for encodeOnly and decodeOnly for @ConfiguredJsonCodec by Espen Wiborg (#847).
  • Removal of all methods deprecated in 0.9 (#888).
  • A small optimization for JsonObject (#889).
  • No more Scala 2.10!

The 0.10.0 release is likely also to include versions of #697, #856, and #754, and to fix #885, #855, and #792. Feedback about other features or priorities you want to see in 0.10 would be appreciated. I'm hoping to publish 0.10.0 by mid-May, but no promises.

I don't currently intend to publish other circe projects depending on this milestone release, but if there's demand (and pull requests) I'd be happy to.

@travisbrown travisbrown released this Mar 28, 2018 · 174 commits to master since this release

Assets 2

This release fixes a bug that was introduced in 0.9.2 that resulted in Decoder#validate not working correctly in error-accumulation mode. The Scala 2.12 version has also been bumped from 2.12.4 to 2.12.5. There are no other changes, and users that don't use validate together with methods like decodeAccumulating should be unaffected by both the bug and this fix.

@travisbrown travisbrown released this Mar 13, 2018 · 174 commits to master since this release

Assets 2

Please note: this release introduces a bug in Decoder#validate and all users should update directly to 0.9.3.

This patch release fixes two bugs:

  • The kleisli value on JsonObject is now transient (thanks to @rpless in #845).
  • Decoder#validate now respects error accumulation (thanks to @voidcontext in #838).

It also bumps the Scala.js version to 0.6.22. Compatibility with previous 0.9 releases has been confirmed with MiMa.

@travisbrown travisbrown released this Jan 19, 2018 · 187 commits to master since this release

Assets 2

This patch release fixes a bug in circe-generic on Scala.js that resulted in generic derivation failing (at compile time) for some cases where it should succeed. This bug did not affect platforms other than Scala.js, and only turns up when using fully-automated derivation (i.e. semiauto and JsonCodec worked as expected).

Thanks to Otto Chrons for reporting the issue, Sébastien Doeraene for helping to identify the problem, and to Ben Fradet for the fix (and tests).

This release is binary compatible with 0.9.0, and if you're either not using io.circe.generic.auto or not using Scala.js, there's no need to upgrade.

@travisbrown travisbrown released this Jan 1, 2018 · 198 commits to master since this release

Assets 2

This is the first circe release for Cats 1.0. I've aggregated a summary of the changes here, but please see the release notes for the three 0.9.0 milestones for more detail:

Additions

  • New Json.Folder for folding Json values with fewer allocations (#656).
  • New Printer#reuseWriters for ThreadLocal string builder caching (#657).
  • New JsonObject.apply method (#637).
  • New := syntax for object definitions (#589).
  • New instances for java.time.Duration (#636).
  • New circe-numbers-testing module (#652).
  • New asNull and withNull methods for Json (#656).
  • New Fold[JsonObject, (String, Json)] instance in circe-optics (#642).
  • New AsyncParser parsing mode configuration in circe-streaming (#712).
  • New transformConstructorNames configuration option in circe-generic-extras (#648).
  • New number parsing benchmarks (#695).
  • New JsonObject benchmarks (#698).
  • New data directory with Sonatype download stats (#675).
  • New derivation helpers for value classes in the generic-extras module (#661).
  • New Decoder#either convenience method (#759).
  • New escapeNonAscii configuration option for Printer that causes all non-ASCII characters to be escaped when printing JSON (#794).
  • New configuration helpers for kebab-cased JSON object keys in the generic-extras module (#790).
  • New Encoder and Decoder instances for Java's boxed versions of primitive types, as well as BigInteger and BigDecimal (#802).

Renaming and API changes

  • Printer#dropNullKeys is now dropNullValues (#702).
  • ACursor#values and keys now return Iterables instead of Vectors (#696).
  • Decoder.decodeCanBuildFrom has been replaced by decodeTraversable and decodeArray (#728).
  • withSnakeCaseKeys is now withSnakeCaseMemberNames (#684).
  • transformKeys is now transformMemberNames (#684).
  • JsonObject.from is now fromFoldable (#696).
  • BiggerDecimal.fromDouble is now fromDoubleUnsafe (#667).
  • Encoder.forProductN now takes a function to ProductN rather than tuples (#673).
  • Decoder#product (which returned a function from two cursors) has been removed, Decoder#and has been renamed to Decoder#product (#798).

Deprecations

  • The truncateToX methods on JsonNumber are now deprecated (#706).
  • ACursor#fields and fieldSet are now deprecated in favor of keys (#696).
  • Decoder#split and Decoder#and have been deprecated (#798).

Bug fixes

  • maxDigits is respected in BiggerDecimal#toBigIntegerWithMaxDigits (#655).
  • handleErrorWith in the MonadError instance for KeyDecoder now works correctly (#676).
  • Generic derivation doesn't fail for nested sequences of tagged types (#659).
  • Partial decoders work with -Ypartial-unification (#728).
  • Fixed new issue with Scala.js tests on 2.10 (#731).
  • Hygiene tests and benchmark modules are now aggregated (#670).
  • disjunctionCodecs provides more exact ObjectEncoder instances (#757).
  • Some fixes for Serializable-related issues, and more tests (#796).

Other changes

  • More instances are serializable (#671).
  • Laws in circe-testing now use Shrink[Json] instance (#666).
  • Better error messages for Decoder.decodeList (#643).
  • Decoder#failedWithMessage includes history (#646).

Documentation and testing

  • Improved documentation for SI-7046 workarounds (#644).
  • Improved KeyEncoder documentation (#699).
  • Test reorganization (#669).

Internal changes

  • Performance improvements for JsonObject (#696).
  • Performance improvements for Printer (#657).
  • Performance improvements for KeyDecoder (#694).
  • Performance improvements for for binary printing (#739).
  • Renamed Json case class members for consistency (#653).
  • Minimized internal use of Json constructors (#674).
  • JsonBigDecimal now uses Java's BigDecimal rather than Scala's (#668).
  • Prefer underlying when using Scala's BigDecimal and BigInt (#689).
  • Prefer unaliased cats.kernel imports (#705).
  • Some whitebox macros replaced with blackbox ones (#762).
  • More reproducible builds (#791).

Updated versions

  • Cats: from 0.9.0 to 1.0.0.
  • Jawn: from 0.10.4 to 0.11.0.
  • Scala.js: from 0.6.16 to 0.6.21.
  • Shapeless: from 2.3.2 to 2.3.3.

New adopters

New related projects

Thanks to the 41 people who contributed to this release, and to everyone who was brave enough to try out the milestones and report issues or provide feedback!

Pre-release

@travisbrown travisbrown released this Dec 21, 2017 · 207 commits to master since this release

Assets 2

This release updates the Cats version from the first to the second 1.0.0 release candidate. It also updates the Scala.js version (from 0.6.20 to 0.6.21) and several patch and plugin versions.

There's one major set of breaking API changes: the old Decoder#product (which returned a function from two cursors) has been removed, Decoder#and has been deprecated and renamed to Decoder#product, and Decoder#split has been deprecated.

This release also includes several other additions and changes:

  • @haraldme added a escapeNonAscii configuration option to Printer that causes all non-ASCII characters to be escaped when printing JSON.
  • @tlangs added configuration helpers for kebab-cased JSON object keys to the generic-extras module (#790).
  • @howyp added Encoder and Decoder instances for Java's boxed versions of primitive types, as well as BigInteger and BigDecimal (#802).
  • @s-nel added Encoder and Decoder instances for java.time.OffsetTime to circe-java8 (#810).
  • @liff resolved some Serializable-related bugs (#763).
  • I made some changes to circe-generic that are intended to support more reproducible builds (#791).

Thanks to all contributors and tire-kickers, and please keep an eye out for the final 0.9.0 release that will be available shortly after Cats 1.0.0 is published (probably next week).

Pre-release

@travisbrown travisbrown released this Nov 2, 2017 · 248 commits to master since this release

Assets 2

This is the second 0.9.0 milestone release, and the first circe release for yesterday's Cats 1.0.0-RC1.

This release removes circe-streaming from this repository (see #774 and Gitter for discussion). It will shortly be resurrected into its own repository in the circe organization, and I'll publish an 0.9.0-M2 release for it once we get this issue resolved. Thanks to @aeons for taking care of this clean-up and for setting up the new repository.

This release includes a few changes not in 0.9.0-M1:

  • @pjan has added derivation helpers for value classes to the generic-extras module (#661).
  • @vkostyukov added some performance improvements for binary printing (#739).
  • @jonas updated the project to sbt 1.0 (#761).
  • @nigredo-tori changed disjunctionCodecs to use the more precise ObjectEncoder (#757).
  • @lukestephenson reverted the type of a deprecated method to ease upgrades from 0.8 (#737).
  • @aeons fixed some docs (#740).
  • @allantl added some missing pieces to the tutorial (#755).
  • There's a new Decoder#either convenience method (#759).
  • We use blackbox macros in a couple of places we'd previously used whitebox (#762).
  • The Scala.js version is now 0.6.20 (#741).
  • Lots of other versions are updated (#750, #758, #764, #771, etc.).
  • We added two adopters to the adopters list (#752, #772).

Thanks to all contributors, and also to everyone brave enough to try out these milestone releases!