3Hren/msgpack-rust

serializing cloudevent is not working

Closed this issue · 0 comments

Hi I am trying to serialize cloudevent to msgpack using rmp_serde. Here is my piece of code:

let event = EventBuilderV10::new()
    .id("03b0fe5d-1285-6706-4735-6caf9bfaa852")
    .ty("com.314e.muspellarchive.export")
    .source("muspell-archive")
    .subject("subject")
    .data("application/json", json!({"hello": "world"}))
    .build().unwrap();

let buff = rmp_serde::to_vec_named(&event).unwrap();

let event1 = rmp_serde::from_slice::<Event>(buff.as_slice()).unwrap();
println!("{:?}", event1);

When I deserialize the data I am missing data part of the cloudevent.

Appreciate help.