Releases: jonasrichard/ejson
Upgrade dependencies
Upgraded dependencies, basically jsx only to 2.9.0. Auto tests now runs on >= Erlang 20.3.
Bug fixed
Thanks to the contributors a few hard-to-catch bugs are fixed in this release.
- Skip undefined values rather then convert them to null if undefined is default (Dmitry Belyaev)
- application id is a string instead of an atom (João Henrique Ferreira de Freitas)
Better type support
- __rec field is generated when it is needed (untyped list, untyped record)
- from_json function needs target type (!)
Make API more generic
In this release the rules are reworked again, so there are couple of incompatible changes.
- Only typed fields are supported (number, boolean and record added)
- Pre- and post-process callbacks are extended to any types.
- With generic type we can convert directly from/to jsx terms (by-passing ejson conversion engine)
Rethinking API, reimplementing rules
In the first release problems came up, so there was a good chance to capture the requirements. At the same time I thought it was safe to implement the encoding/decoding rules by property-based testing driven development. It is a fun, and it covered many errors I didn't think about.
I also reworked the conversion rules, to get rid of extra tuples, and make place for conversion option as well.
Option for raw field conversion
In this release there is a field_fun_json_term
conversion rule which is very similar to the field_fun
, but after applying the fun to the field this new rule doesn't call json conversion on the result.
Postprocess generated json term
With ejson:to_json_term/2
or to_json_term_module/2
one can get not the final JSON string but a term which is in the format JSX library uses. With that call you can post-process the JSX term before converting it to binary.
Field and record preprocessing
{rec_fun, Name, {Module, Function}}
creates a calculated field from the whole record value{field_fun, Name, {Module, Function}}
calculates a field from the current field value{const, Name, Value}
creates constant field
Preprocessing and transient fields
Field preprocessing and transient fields are implemented.
0.1.1
Extracting module attributes