Term and LeafAnswer serde serialization #2707
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As a lot of things moved around, I thought making a new PR would be easier than rebasing #2493. This also gives us a clean slate to discuss. The old PR was getting a bit too big, and Github is notoriously bad for big threads of discussions in issues/PRs.
This basically gets to the same point that #2493 was, but with a change to rationals following #2505 (comment) (basically now they are serialized as
{"rational": {"numerator": ..., "denominator": ...}}
), and also without migrating the integration tests. I believe this will still change a bunch so I defer migrating the integration tests (which depend on serialization) to after this gets merged. This also doesn't have the deserialization from #2505.@jjtolton, if you really want to continue the JSON API route in #2465 you should rebase onto this. I feel maybe just doing C APIs for dealing with
Term
(and with that wrapping libraries can do JSON themselves in whatever way they want) will be a faster path to merging than waiting to reach consensus on the serialization format here.Most relevant points in the discussion until now, to recap:
f64
for all numbers), maybe it makes sense to always encode numbers as strings, tough it seems kinda unfortunate to force users to parse numbers even for small integers: Value and QueryResolution serialization with serde #2493 (comment) Value and QueryResolution serialization with serde #2493 (comment)Also, tip when writing JSON on Github: use json5 in codeblocks. It allows things like comments without freaking out. Compare: