Rocket icon indicating copy to clipboard operation
Rocket copied to clipboard

Allow named msgpack serialization

Open somehowchris opened this issue 3 years ago • 2 comments

Since @SergioBenitez is returning, imma pin that one here https://github.com/rocket-org/Rocket/issues/18 @Cloudef

Is your feature request motivated by a concrete problem? Please describe.

Currently the serde::msgpack::MsgPack included with rocket only does "compact serialization", meaning it doesn't serialize key names, only values in arrays. To be JSON compatible, and to avoid bugs it would be nice to have "named serialization".

Why this feature can't or shouldn't live outside of Rocket

The serde::msgpack is already in rocket.

Ideal Solution

It seems the problem is here: https://github.com/Rocket-org/Rocket/blob/cc0621626bf5e917ea1d4c1e29a327e9a7871921/core/lib/src/serde/msgpack.rs#L191 This should be changed to rmp_serde::to_vec_named, however since I'm still fairly new to rust, I don't know how this would be exposed so that the developer can choose either from the compact or named serialization form.

somehowchris avatar Feb 18 '22 08:02 somehowchris

See https://github.com/SergioBenitez/Rocket/pull/1882#issuecomment-1043675477.

SergioBenitez avatar Feb 23 '22 22:02 SergioBenitez

@Cloudef

somehowchris avatar Feb 24 '22 09:02 somehowchris