ciborium icon indicating copy to clipboard operation
ciborium copied to clipboard

[Bug]: Uuid unable to deserialize from string

Open mdtusz opened this issue 6 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Current Behaviour

When trying to deserialize to a struct containing a Uuid from a string representation, deserializing fails.

#[derive(Serialize, Deserialize)]
struct Foo {
 id: Uuid
}

let id = Uuid:new_v4();
let c = cbor!({ "id" => id.to_string() }).unwrap();

let parsed: Foo = c.deserialized().unwrap();

assert_eq!(parsed.id, id);

This previously worked, but I am unable to track down when exactly the issue arose, where exactly the issue lives, or whether it is indeed an issue with ciborium, or an issue with serde or uuid - any guidance will be appreciated.

Expected Behaviour

I would expect for ciborium/serde to allow for parsing string UUID values into Uuid's, as they will often be written as strings by CBOR clients.

mdtusz avatar Aug 15 '24 06:08 mdtusz