Skip to content

Bare, raw ... just plain!

Compare
Choose a tag to compare
@Strech Strech released this 27 Feb 13:02
· 42 commits to master since this release
fad181c

In this release, a potential collision between 2 formats was removed. In several cases (see #70) messages encoded with format: :plain could match a format: :registry magic byte sequence. It will lead to an error in decoding with format: :guess.

From now on it is recommended to use special crafted Avrora.encode_plain/2 and Avrora.decode_plain/2 while working with plain encoded Avro messages, thanks for the effort to @mw23 💙

{:ok, pid} = Avrora.start_link()

message = <<8, 116, 120, 45, 49, 123, 20, 174, 71, 225, 250, 47, 64>>
{:ok, decoded} = Avrora.decode_plain(message, schema_name: "io.confluent.Payment")
%{"id" => "tx-1", "amount" => 15.99}

message = %{"id" => "tx-1", "amount" => 15.99}
{:ok, encoded} = Avrora.encode_plain(message, schema_name: "io.confluent.Payment")
<<8, 116, 120, 45, 49, 123, 20, 174, 71, 225, 250, 47, 64>>

In addition, the project readme was clean up and adopted to be transformed as close as possible by ExDoc for hexdocs.pm. And as a bonus compilation should not throw any warnings about docs or specs, thanks for bringing it up to @fxn 💚