Closed cgadski closed 2 years ago
Hi @cgadski. I opened PR #123 that should fix this and also that other issue related to namespace name overriding. Thanks for providing those examples it was easy to make tests against those.
Feel free to pull that PR from my fork and test it if there is something still missing. I think I added something related to enum defaults feature some time ago and have used it and avro4k with one project but luckily this have not been an issue. Or haven't really realised what the actual implementation by defined the avro documentation should be. Thanks for noticing this
@cgadski thanks for raising this issue. The fix provided by @kossi has been merged. Before building a new release, I need to fix another issue regarding sealed interfaces.
Problem
According to the avro documentation, when an enum type has a default value, out-of-range enum values will be decoded to the default. However,
Avro.default.decodeFromByteArray
does not respect this behavior; instead, when decoding an enum that takes an unknown value, it always throws an exception.Minimum Working Example
I expect the assertion to pass, but it fails with the following exception: