cbor
cbor copied to clipboard
Deserialization of enum variants only accepts fixed length map
https://github.com/pyfisch/cbor/blob/a218403a52e60c991313f429e4acc05cce81ce25/src/de.rs#L859
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..
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.