-
Notifications
You must be signed in to change notification settings - Fork 121
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
add deserialize impls for #2493 #2505
base: master
Are you sure you want to change the base?
Conversation
- including proptest to verify roundtrip
Ok(Value::Integer(int)) | ||
} | ||
"rational" => { | ||
let parts = map.next_value::<Vec<serde_json::Value>>()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bakaq having the value for "rational" be a list containing the numerator and the denominator made this somewhat difficult to deserialize here, due to one being signed while the other is unsigned and due to the fallback for large numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you think of any alternative? We need to store the numerator and denominator separately anyway, and being able to represent large integers is desirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with internally tagged we could just have a numerator
and divisor
field next to the type
tag field i.e. { "type": "rational", numerator: ..., divisor: ... }
or with untagged the value could be an object/map rather than a list i.e. { "rational": { "numerator": ..., "divisor": ... }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I like the internal tagging one.
.prop_map(|map| QueryMatch { bindings: map }) | ||
} | ||
|
||
fn float_roundtrips(&orig: &'_ f64) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to enable the float_roundtrip
feature for the serde_json
crate to ensure all f64 roundtrip perfectly
No description provided.