smithy-rs/codegen-client-test/model
Miles Ziemer 345624eb6c
Ignore actual default value instead of 0/false (#3252)
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Previously, there was logic used to ignore the default 0/false values
for numbers/booleans when serializing members if they weren't boxed.
This was to fix issues that occured when upstream models didn't properly
box shapes that were meant to be optional, and for the most part worked
because services would just fill in the default if it wasn't passed.
However, with Smithy 2.0, models may have defaults != 0/false, but the
codegenerator still ignores the zero value.

## Description
<!--- Describe your changes in detail -->
This commit makes it so that the actual default value for the member is
ignored for booleans and numbers, instead of just 0/false. It also
updates serialization for http bindings so that headers and query
parameters with 0/false values aren't ignored if they are optional
parameters.

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
- [x] Generated AWS SDK and inspected diff. Only changes are not
ignoring default value inside `if let Some() = ...` blocks, and ignoring
default value instead of just 0 (only seems to effect nimble).
- [x] Added protocol tests for serializing 0/false in query params for
restXml and restJson

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: John DiSanti <john@vinylsquid.com>
2023-12-15 16:37:36 +00:00
..
basic-enums.smithy Establish the `codegen-core` module (#1697) 2022-09-07 09:31:46 -07:00
dynamodb.json Establish the `codegen-core` module (#1697) 2022-09-07 09:31:46 -07:00
endpoint-rules.smithy Merge 0.56.x back into main (#3003) 2023-09-28 13:20:04 +00:00
error-correction-nullability-test.smithy add support for nullable struct members when generating AWS SDKs (#2916) 2023-09-21 17:20:51 +00:00
main.smithy Establish the `codegen-core` module (#1697) 2022-09-07 09:31:46 -07:00
more-nesting.smithy Establish the `codegen-core` module (#1697) 2022-09-07 09:31:46 -07:00
nested.smithy Establish the `codegen-core` module (#1697) 2022-09-07 09:31:46 -07:00
rest-xml-extras.smithy Ignore actual default value instead of 0/false (#3252) 2023-12-15 16:37:36 +00:00
rest-xml-unwrapped-errors.smithy Establish the `codegen-core` module (#1697) 2022-09-07 09:31:46 -07:00