wolf4ood / gremlin-rs

Gremlin Rust
Apache License 2.0
108 stars 30 forks source link

Serde Default Doesn't Handle Explicit Null Value #209

Closed criminosis closed 7 months ago

criminosis commented 7 months ago

Turns out my original PR missed one of the two cases 🤦‍♂️

called `Result::unwrap()` on an `Err` value: Error("invalid type: null, expected a string", line: 1, column: 76)

#[serde(default)] doesn't handle when the value is explicitly set to null like "message": null.

Without bringing in an additional dependency like serde_with this can be handled with a small additional deserializer.

I'll also add test cases like I should have in the first place to make sure this gets it this time @wolf4ood 👍