Most of the enhancements in this release concern JSON support.
- JSON support for Google types. The library now supports JSON mapping of
Google.Protobuf.*
types such as timestamps, durations, type wrappers, and so on. In order to use this correctly, you need to manually generate the Protobuf Elixir files from the.proto
files provided by Google since they are not shipped with this library. - Accept integer numbers for float fields when decoding JSON.
- Add
Protobuf.encode_to_iodata/1
. - Add the
one_file_per_module
CLI option when using theprotoc-gen-elixir
plugin. - Use type-aware defaults in struct definitions for Protobuf messages. This
means that now doing
%MyMessage{}
should be equivalent toMyMessage.new()
. - Don't generate the
transformer_module/0
callback in generated Protobuf modules if thetransformer_module
CLI option is not used.
- Fix enum aliasing in JSON mapping.
- Fix encoding of default values when using transformer modules.
- Raise a
Protobuf.DecodeError
when decoding if fields with number0
are encountered. - Fix bugs when decoding big varints, integers, and so on (by casting).
- Cast enum integers to int32 when they overflow when decoding.
- Skip encoding for fields if they match their user-defined default in proto2.
- Fix decoding and encoding of packed repeated fields.
- Don't pack fields that use the
[packed = false]
option explicitly in proto3.
- JSON encoding and decoding support.
- Extensions support.
- Enum alias
(
allow_alias
) support. - Faster and more memory-efficient encoding and decoding algorithms.
- More accurate typespecs for repeated fields and enums.
- Add
package_prefix
command-line option to control namespacing on generated code. - Add
transform_module
command-line option with hooks for custom pre-encode and post-decode logic.
- Fix decoding of proto2 payloads containing legacy
group
fields. Instead of crashing the decoder, those fields are now skipped. - Fix compilation warnings on recent versions of Elixir.
- Fix
new!
to raiseArgumentError
when given struct and module don't match.
- Dropped support to OTP 21.1 and lower.
- Add typespec generation for enum fields.
- Add
new!/1
function to generated modules with strict field validation. - Raise
Protobuf.DecodeError
when unable to decode binary input. - Add
--version
command-line flag.