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.
Motivation and Context
Generated clients currently don't serialize the value
0
andfalse
for members that have a default value. It seems like this logic was originally added to fix issues with S3 which are technically modeling issues and have since been fixed. Not serializing zero values has caused issues in the past, for example awslabs/aws-sdk-rust#630, and in other SDKs that do it like Go v2: aws/aws-sdk-go-v2#2162. Also the Smithy spec says clients should serialize default values, which generated clients currently do not do if that default is0
/false
.Description
Removes logic from RustWriter that was used to not serialize zero values, ie. 0 for numbers and false for booleans, if that was also the default value for the member. With this change, the only time the default value for a member is not serialized is if the member is also
@clientOptional
per Smithy spec.The Blob type was also updated to implement std::Default, since SymbolVisitor treats
""
as a RustDefault.Important: This change impacts all the protocols and will cause many members to now be sent over the wire that previously weren't.
Testing
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.