Skip to content
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

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Conversation

Skgland
Copy link
Contributor

@Skgland Skgland commented Aug 26, 2024

No description provided.

Ok(Value::Integer(int))
}
"rational" => {
let parts = map.next_value::<Vec<serde_json::Value>>()?;
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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": ... }}

Copy link
Contributor

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.

@Skgland Skgland changed the title add dereialize impls for #2493 add deserialize impls for #2493 Sep 3, 2024
.prop_map(|map| QueryMatch { bindings: map })
}

fn float_roundtrips(&orig: &'_ f64) -> bool {
Copy link
Contributor Author

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

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

Successfully merging this pull request may close these issues.

2 participants