This changes how structs with optional fields are serialized. Previously, fields whose value was set to None were serialized in the JSON as null. This works, but is unnecessarily verbose, but the bigger deal is that it isn't accepted by our deserializer code.
With this change, we skip writing these fields entirely.
Now, we could fix the deserializers to accept null for Option fields, but for now let's just stop using null entirely. We can always add that support later if there's a good reason to.
This also beefs up the tests by adding test cases for structs which omit all the optional fields, which is how I verified this works correctly. These tests will also be good for catching compatibility issues in the future.
Checklist
General Contributing
[x] I have read the Code of Conduct and signed the CLA.
[x] I have added an entry to the RELEASE_NOTES.md file, or believe it's not necessary for this change.
This changes how structs with optional fields are serialized. Previously, fields whose value was set to
None
were serialized in the JSON asnull
. This works, but is unnecessarily verbose, but the bigger deal is that it isn't accepted by our deserializer code.With this change, we skip writing these fields entirely.
Now, we could fix the deserializers to accept
null
forOption
fields, but for now let's just stop usingnull
entirely. We can always add that support later if there's a good reason to.This also beefs up the tests by adding test cases for structs which omit all the optional fields, which is how I verified this works correctly. These tests will also be good for catching compatibility issues in the future.
Checklist
General Contributing
RELEASE_NOTES.md
file, or believe it's not necessary for this change.Validation
test change included