ugorji / go

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]
MIT License
1.86k stars 295 forks source link

Support encode/decode struct where stream has integer-encoded fields #223

Closed ugorji closed 6 years ago

ugorji commented 6 years ago

Some formats like to use numeric codes for the fields. This means that they define a set of fields, assign numeric codes to them, and encode those numeric codes in the encoded stream.

For example, DOTS specification required integer type cbor key element (see 6. Mapping Parameters to CBOR in https://datatracker.ietf.org/doc/draft-ietf-dots-signal-channel/ )

As it is still a structured field, a struct is the natural programming construct.

We should support this natively.

See #222

ugorji commented 6 years ago

Fixed via 4d084a865916fe7ff62fa96d585e50820da2fdfb