You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried using the library to serialize/deserialize XML for an API but I didn't get far.
There's two tests at the bottom producing this behaviour.
When deserializing, the error is thread 'api::tests::deserialize' panicked at 'called Result::unwrap()on anErrvalue: Custom("missing fieldRequestTimestamp")'.
When serializing, the output (using --nocapture) is <OJP><OJPRequest><ServiceRequest><RequestTimestamp>2022-03-24T07:56:40.192049665Z</RequestTimestamp></ServiceRequest></OJPRequest></OJP>.
Modifying the xml string like this solves the issue and the library expects RequestTimestamp to be somewhere else.
let xml = r#"<OJP><RequestTimestamp>2022-03-24T07:48:03.571299970Z</RequestTimestamp><OJPRequest><ServiceRequest></ServiceRequest></OJPRequest></OJP>"#;
The text was updated successfully, but these errors were encountered:
I think, this is expected, because names of any types does not have any meaning. If you see an element in the XML and want to use it name, you should map it or to a struct field, or to an enum variant. That are things that is not expected to be changed.
You can also find a more info in my not yet finished PR, that describes things as it should be (and in many cases they already behaves as described).
(The better way to read it is to checkout branch and build rustdoc, because information in PR description is outdated).
I've tried using the library to serialize/deserialize XML for an API but I didn't get far.
There's two tests at the bottom producing this behaviour.
When deserializing, the error is
thread 'api::tests::deserialize' panicked at 'called
Result::unwrap()on an
Errvalue: Custom("missing field
RequestTimestamp")'
.When serializing, the output (using --nocapture) is
<OJP><OJPRequest><ServiceRequest><RequestTimestamp>2022-03-24T07:56:40.192049665Z</RequestTimestamp></ServiceRequest></OJPRequest></OJP>
.Modifying the xml string like this solves the issue and the library expects
RequestTimestamp
to be somewhere else.The text was updated successfully, but these errors were encountered: