Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

from_str::<Value>() interprets entire input as string in some cases #372

Closed
cloneable opened this issue Apr 21, 2023 · 1 comment
Closed

Comments

@cloneable
Copy link

from_str::<Value>() interprets entire input as string.

fn main() {
    let toml_actually = r#"
presectionfield = 123

[never.valid.yaml]
field = true
otherfield = "string"
"#;
    serde_yaml::from_str::<serde_yaml::Value>(&toml_actually).unwrap_err();
}

Removing the "presectionfield" makes serde_yaml return an error.

@dtolnay
Copy link
Owner

dtolnay commented Apr 21, 2023

This is consistent with the spec as far as I can tell. That input is indeed a valid yaml document containing a single unquoted string.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants