Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Releases: netvl/picopickle

Version 0.3.0

10 Apr 19:27
Compare
Choose a tag to compare

This release contains only one small feature, but it is a minor version bump instead of a patch version
because the previous version bump was incorrect - in 0.2.1 shapeless dependency was updated, which is binary
incompatible with its previous versions.

  • Added support for serializing value classes, that is, those extending AnyVal, as regular values. While this
    was absolutely possible to do manually in previous versions of picopickle, this release introduces tools to make
    it automatic. You can find more in the readme.
  • Updated Scala version to 2.11.8.

Version 0.2.1

03 Mar 19:56
Compare
Choose a tag to compare

This release contains only internal changes and dependency versions bumps.

  • Updated shapeless to 2.3.0, macroparadise to 2.1.0, jawn to 0.8.4, bson to 3.2.2, scala to 2.10.6. The most
    important update here is shapeless 2.3.0.
  • After shapless, switched to macro-compat instead of hand-written
    macro API for 2.10 and 2.11. This should greatly simplify supporting custom macros.

Version 0.2.0

06 Jul 09:25
Compare
Choose a tag to compare

This release contains a lot of changes and new features.

Updated shapeless to 2.3.3, jawn to 0.8.8, scala to 2.11.7.

In particular, updating shapeless allowed using picopickle with case classes with variable arguments.

Improved reader interface - added readOrElse method and changed existing code to depend on it.

readOrElse is borrowed from PartialFunction trait where it is called applyOrElse. It is an
important method for optimization because it allows checking whether a function (reader) can be
applied to a value and apply it to this value at the same time. Now Reader trait has this method
and it is defined and used correctly by the built-in Reader combinators, in particular,
for error checks.

Added proper error handling.

While writing data to backend representation is usually an error-free operation (if there is a writer
for some type, it should handle all values of this type), reading data from the backend representation
is a source of errors. This happens because the backend representation has much weaker typing guarantees
than Scala code and can't correspond directly to Scala types.

Previously picopickle didn't provide any special error handling. If the backend value couldn't be
deserialized, picopickle would throw some obscure MatchError or IllegalArgumentException. Since
0.2.0 picopickle has a proper exception system, and if a read error occurs, the exception would contain
much more information about what was expected and what was actually found. You can find more on it
in Readme.

Added new BSON-based backend.

A new officially supported backend has been added. It uses MongoDB BSON data types
as the backend representation.

With this backend it is possible to use picopickle for serialization using the official Mongo drivers.

It also serves as an example extended backend implementation with more types than the basic backend
supports.

Added support for changing STH discriminator key on per-STH basis.

It is now possible to change sealed trait hierarchy discriminator key for each sealed trait separately:

@discriminator("status") sealed trait Root
case object Stopped extends Root
case class Running(name: String) extends Root

writeString[Root](Stopped)       shouldEqual """{"status":"Stopped"}"""
writeString[Root](Running("me")) shouldEqual """{"status":"Running","name":"me"}"""

This allows even more flexibility in defining serialization formats, especially when matching some
existing interface.

More information can be found in the readme.

Version 0.1.3

11 Jun 14:00
Compare
Choose a tag to compare

Added two new features - serialization objects and object key serialization:

  • serialization objects allow one to "specialize" generic read()/write() pickler
    methods for some specific type for convenience and type safety;
  • object key serialization makes it possible to serialize maps with arbitrary keys
    as backend objects (which currently is possible only for string keys) provided that
    there is a special serializer for key type is present in implicit scope. It is also now
    possible to disallow the default behavior when maps are serialized as arrays of arrays
    and only enable it explicitly for specific key types.

Version 0.1.2

27 Apr 08:55
Compare
Choose a tag to compare

Updated Scala 2.10 minor version (was 2.10.4, became 2.10.5). This matters because shapeless depends on the minor version of Scala 2.10.

Version 0.1.1

27 Apr 08:50
Compare
Choose a tag to compare

This is a bugfix release.

  • Fixed a problem with classes whose companion objects have overloaded apply methods.

First public release

25 Mar 10:04
Compare
Choose a tag to compare

This is the first public release.

picopickle is a lightweight shapeless-based serialization library. It is very extensible and flexible, does not use reflection and supports almost arbitrary serialization formats - anything which is representable with JSON-like data types is supported out of the box with a minimal shim code, and writing support for something more complex is very simple.

Currently picopickle supports serialization and deserialization to and from JSON and Scala collections, but more backends are planned. picopickle uses a very fast JSON parser, jawn, to parse JSON data.

What is available in this release:

  • serialization and deserialization of all basic Scala types: primitives, strings, symbols, options, eithers, etc;
  • serialization and deserialization of almost all Scala collections;
  • serialization and deserialization of almost arbitrary sealed trait hierarchies, i.e. case classes and case objects,
    possibly implementing a sealed trait;
  • case class serialization supports renaming the fields and classes, default values and optional fields, as well as circular type dependencies;
  • customizable nulls handling;
  • two backends - JSON and collections, allowing serialization and deserialization to and from JSON and collections, respectively;
  • a converters library which provides a DSL for writing custom serializers in a declarative way.

picopickle is heavily inspired by upickle, but it does not do everything I needed, and I couldn't manage to fix it - there were compiler errors I didn't know how to overcome. shapeless, however, provide a lot of tools, including lazy implicits, which made writing a serialization library a very easy task.

You can find more in the readme.