aviramha / ormsgpack

Msgpack serialization/deserialization library for Python, written in Rust using PyO3 and rust-msgpack. Reboot of orjson. msgpack.org[Python]
Apache License 2.0
239 stars 15 forks source link

How canonical is `ormsgpack`? #259

Open apoorvkh opened 5 months ago

apoorvkh commented 5 months ago

Hi, I was wondering how "canonical" ormsgpack is: i.e. will any two equal objects result in the same serialized bytes?

I found this issue (https://github.com/msgpack/msgpack/issues/215) that says the msgpack specification is not canonical. But I am wondering if the ormsgpack implementation is canonical. (I realize the one edge case is that dictionary elements should be sorted to maintain consistency.)

On the other hand, I see that datetime and dataclass objects serialize to their string or dictionary equivalents. Thus, two objects with different types may serialize to the same bytes. Are there any other cases where that is also true?

Would appreciate some input. Thanks a lot!