-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Uuid unable to deserialize from string #138
Comments
@mdtusz are you using the Uuid serde feature flag in cargo.toml?
|
As far as I know, there's no feature flag for [dependencies]
ciborium = "=0.2.2"
serde = { version = "1.0", features = ["derive"] }
uuid = { version = "1.5", features = ["serde", "v4"] } This configuration causes the example I included above to fail, but downgrading to I haven't been able to track down the source of this in |
I wasn't able to get this test to work on 0.2.1 either by the way, so I don't think it's a 0.2.1 to 0.2.2 change? Tested on both the ciborium v0.2.1 and v0.2.0 git tag commits. #[test]
fn uuid() {
let uuid = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000").unwrap();
// encode to bytes
let mut encoded = Vec::new();
into_writer(&uuid, &mut encoded).unwrap();
assert_eq!(encoded, hex::decode("50550e8400e29b41d4a716446655440000").unwrap());
// decode from bytes
let encoded = hex::decode("50550e8400e29b41d4a716446655440000").unwrap();
let decoded: Uuid = from_reader(&encoded[..]).unwrap();
assert_eq!(uuid, decoded);
// decode from string
let encoded = hex::decode("782435353065383430302D653239622D343164342D613731362D343436363535343430303030").unwrap();
let decoded: Uuid = from_reader(&encoded[..]).unwrap();
assert_eq!(uuid, decoded);
} |
Is there an existing issue for this?
Code of Conduct
Current Behaviour
When trying to deserialize to a struct containing a Uuid from a string representation, deserializing fails.
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
oruuid
- 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.
The text was updated successfully, but these errors were encountered: