Add serde from/to string impl#53
Conversation
|
Thank you very much for this huge contribution. This has been a highly requested feature for the library. I'll put this PR on hold for a tiny bit. There is a lot here to unpack, and I think I'll make a few changes directly on your branch before I come back to you.
It is! Welcome to the world of Open Source! 👋 I'll set this PR as a draft, fix a few of the above, and come back to you. Does that work for you? I'll make this my priority on this crate. I expect to have done a bit Sunday evening (EU time) at the latest. |
|
Hi, great that I can contribute! I know there were rough edges, but I wanted to put it out there in case someone else was already working on it :) I can redo the tests in the roundtrip style, if you want. Probably can also run against the yaml test suite by deserializing to serde_json::Value and writing json to compare, right? |
|
I'm sorry, IRL has been hectic and I haven't had the energy to fully come back to this. Thank you very much for your interest!
What I would rather do is compare the fn f(input: &s) {
match Yaml::load_from_str(s) {
Ok(saphyr) -> assert_eq!(saphyr, saphyr_serde::from_str(s).unwrap(),
Err(_) -> assert!(saphyr_serde::from_str(s).is_err())
}
} |
Hi,
Thanks for the great YAML parsing library! I needed to do some parsing of Yaml into tera::Values, so instead of just doing a translation from saphyr::Yaml to tera::Value, I instead wrote a serde desrializer 😅. I figured this might also be interesting to the saphyr project due to #1. I also implemented basic serialization, although I don't use it in my project.
I hope this is the correct way to share this. I'm relatively new to both Rust and Open Source contribution, so happy to accept feedback.