jplatte / serde_html_form

Rust crate for (de-)serialization of `application/x-www-form-urlencoded` data.
MIT License
23 stars 3 forks source link

Handle optional values properly #5

Closed thomaseizinger closed 1 year ago

thomaseizinger commented 1 year ago

This series of patches handles optional values in various situations properly.

It is an updated version of https://github.com/jplatte/serde_html_form/pull/4.

thomaseizinger commented 1 year ago

Can you add one more test case? sweat_smile

A struct with a Vec<String> field should have the field deserialized to vec!["", "test"] for the input field=&field=test.

Done!

thomaseizinger commented 1 year ago

I added one more that I think makes sense!

jplatte commented 1 year ago

Thanks a lot for finding such a good and clean solution and covering it with lots of tests! :)

thomaseizinger commented 1 year ago

I must admit I don't 100% understand how it all works, but the fact that only the two deserialize_option methods were changed makes me very confident that there are no weird accidental behavior changes from this.

I think apart from dtolnay himself, nobody really 100% understands how serde works.

jplatte commented 1 year ago

This has been released in v0.1.1 :)