-
Notifications
You must be signed in to change notification settings - Fork 2
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
Deserialization errors are less than informative #8
Comments
Hi @vrurg thanks for reporting! Could you provide a little example to replicate the problem, please? |
Oh, should've done it in first place. A bit overwhelmed and forgot to. Here is a golfed down variant suitable for rust-script: //! ```cargo
//! [dependencies]
//! serde = { version = "1.0", features = ["derive"] }
//! serde_gura = "0.1.8"
//! ```
use serde::{Deserialize, Serialize};
use serde_gura;
use std::{collections::HashMap };
#[derive(Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
struct Cfg {
map: Option<HashMap<String, String>>,
}
fn main() {
let src = r#"map: "no map""#;
let cfg = serde_gura::from_str::<Cfg>(src).unwrap();
println!("{:?}", cfg);
} It results in a message like this:
|
Thanks! I'll check and fix it when I have some spare time, maybe during the weekend |
Hi @vrurg ! Sorry for the delay, it is taking longer than planned. I already managed to implement the report of which was the expected value in each case, but I would like to be able to report what value is being received and what is the conflicting field. I'm going to have to take ideas from some projects like Serde JSON and take the opportunity to update the tech stack and fix some minor flaws. Thanks for your patience 🙏 |
As I'm trying to use Gura as my primary app config format, I stumbled upon a problem where deserialization fails due to incorrect structure of the config, but I all I get is an "Expected map" message from
ExpectedMap
error variant. I'm afraid, it wouldn't be very helpful to a person trying to find out what's wrong with the config. :(Any chance to extend the reporting with at least full path to the problematic key? Also, I checked out with #5, but found no useful information for myself to help with the problem.
The text was updated successfully, but these errors were encountered: