pyfisch/cbor

Deserialization of enum variants only accepts fixed length map

valpackett opened this issue · 1 comments

cbor/src/de.rs

Line 859 in a218403

Some(0xa1) => {

If I try to write an enum as e.g. \xbf\x67variant\x65hello\xff there's a somewhat confusing error: "invalid type: map, expected variant identifier"

This is probably not common (I was just writing a test with manually written cbor bytes) but theoretically some implementation in another language could always rewrite maps into indeterminate length maps..

jcfj commented

I ran into this with CBOR generated from JSON in Java's Jackson.
[Edit:] It also happens with @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT), which is roughly equivalent to serde's external tagging.