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
deterministically serialize number and string JSON output #2527
Conversation
65d88a7
to
5f89021
Compare
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.
While I think this is a change for the better, it may be viewed as a breaking change, even though it can be argued that the existing behavior is a bug. I'm not entirely sure what to do with it. Thoughts?
883d4af
to
bc0f79c
Compare
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.
I think the change from ""
to null
is an acceptable compromise and not enough of a breaking change to warrant a major version bump. I therefore give this 👍🏼. Great work! Please just rebase your changes on HEAD
of main
so we get rid of the merge conflicts and this is good to go.
Ever since the introduction of the JsonOutputFormatter way back in 2014 [1] all fields where serialized as JSON string. Except for values looking like an int which where then serialized as JSON numbers. This had some strange unpredictable side effects like PreReleaseNumber being an empty JSON string instead of null or a "2009069" ShortSha being formatted as a JSON number. This change ensures all fields are serialized as JSON string except Major, Minor, Patch, PreReleaseNumber, WeightedPreReleaseNumber, CommitsSinceVersionSource and UncommittedChanges which are now always serialized as JSON number. Deserialisation remains the same as before for all fields so we continue to accept both JSON string and JSON number formatted values. Fixes GitTools#1688 and fixes GitTools#2304. [1] GitTools@f2daf60#diff-fde1a8ff593c6ac2ad558a6f9bb512e0350db91343b185f9b2a00d1d6e848bc3
bc0f79c
to
d1baac1
Compare
@asbjornu wrote:
Thanks you for taking the time to review this! Rebased as requested 😃 |
@dieterv thank you so much for your contributions 👍 |
Thank you @arturcic 😀 |
🎉 This issue has been resolved in version 5.6.5 🎉 Your GitReleaseManager bot 📦🚀 |
Description
Deterministically serialize number and string JSON output.
Related Issue
Fixes #1688 and fixes #2304.
Motivation and Context
Ever since the introduction of the JsonOutputFormatter way back
in 2014 [1] all fields where serialized as JSON string. Except
for values looking like an int which where then serialized as JSON
numbers. This had some strange unpredictable side effects like
PreReleaseNumber being an empty JSON string instead of null
or a "2009069" ShortSha being formatted as a JSON number.
This change ensures all fields are serialized as JSON string
except Major, Minor, Patch, PreReleaseNumber,
WeightedPreReleaseNumber, CommitsSinceVersionSource and
UncommittedChanges which are now always serialized as JSON number.
Deserialisation remains the same as before for all fields so we
continue to accept both JSON string and JSON number formatted
values.
[1] f2daf60#diff-fde1a8ff593c6ac2ad558a6f9bb512e0350db91343b185f9b2a00d1d6e848bc3
How Has This Been Tested?
Checklist: