fix: Rename Result results_id JSON field name to deal_id #469
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.
Summary
This pull request makes the following changes:
Result.DealID
fromresults_id
todeal_id
Result
functions for backwards compatibilityThe
Result
struct onmain
uses the JSON nameresults_id
for itsDealID
. This pull request changes the JSON name todeal_id
.Test plan
We have added property-based tests that check round trip serialization/deserialization and JSON backwards compatibility. Run the test suite and check that the new tests pass or run the tests directly:
Running a test job takes a few more steps than usual:
bgins/fix-rename-results-id-field
)main
or using a binary at2.10.0
main
or using a binary at2.10.0
These steps check compatibility with a resource provider and job creator that use
results_id
.Details
Resource providers will continue to create results with the
results_id
field name until they have upgraded, and job creators will expect aresults_id
field until they have upgraded.We have implemented a
Result
compatibility layer with custom serialization and deserialization:MarshalJSON
adds theresults_id
field for clients that expect itUnmarshalJSON
checks for aresults_id
field from older clients and assigns it toDealID
We can remove this compatibility layer once clients have upgraded to a version that uses
deal_id
.