Conversation
23d93b1 to
1163f20
Compare
|
Hi @mw23 👋🏼 Thanks a lot for your contribution, I appreciate it! Let me think a bit about proposed changes over weekends |
|
Thanks for the patience @mw23 I've read the code one more time and I think I have something to rise.
At the same time, I think, we should be able to enforce decoding for the As a suggestion, maybe we should come up with UPD: Also by |
1163f20 to
4d93474
Compare
|
Hi @Strech, thank you for considering this. I see your point and agree that separate function(s) might be a way to go to make this cleaner so I went ahead and added To your argument about handling this as exception in Please let me know what you think. |
Strech
left a comment
There was a problem hiding this comment.
Thanks for your effort. I would like to request one thing in addition to the comments.
Can you two made up calls here to validate an external interface
test/avrora/encoder_test.exs
Outdated
| end | ||
|
|
||
| defp numeric_transfer_json_schema do | ||
| ~s({"namespace":"io.confluent","name":"numeric_transfer","type":"record","fields":[{"name":"link_is_enabled","type":"boolean"},{"name":"updated_at","type":"int"},{"name":"updated_by_id","type":"int"}]}) |
There was a problem hiding this comment.
May I ask you to follow the guideline for naming (it's not so important here, but oh my OCD) and rename the schema name to NumericTransfer
test/avrora/encoder_test.exs
Outdated
| 119, 32, 97, 114, 101, 32, 121, 111, 117, 63, 0>> | ||
| end | ||
|
|
||
| defp numeric_transfer_plain_message_0 do |
There was a problem hiding this comment.
Maybe to emphasize the issue we can name it numeric_transfer_plain_message_with_fake_magic_byte
Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>
|
@Strech Thanks for your review. I incorporated the changes you requested. |
|
@mw23 Thanks a lot for such a quick update. Everything looks good to me. I will merge it on a Sunday 💙 |
|
@Strech - that's great news! Thank you! |
This fixes a bug where decoding fails for a data that was encoded with a supplied
schema_nameand:plainformatIf the encoded message starts with the magic byte (0x00) due to the data that was encoded, the wrong codec is selected by
https://github.com/Strech/avrora/blob/master/lib/avrora/encoder.ex#L76
when decoding it later.
This causes the decoding to fail sporadically dependent on the encoded data.
I propose to fix this by including an optional
formatargument to thedecodefunction.Example: New test case that broke before adding the
format: plainparameter