You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: use default value when deserializing non-optional members (#436)
Codegen uses default values to generate the `init` for non-optional values eg. https://github.com/awslabs/aws-sdk-swift/blob/0.2.6/release/AWSSecretsManager/models/Models.swift#L4148 but while doing the deserialization, the member is considered as always present which is not true in service like AWSSecretsManager.
This change uses the the same default value is available to set the member when the response doesn't contain the field. To generate less code, codegen skips assigning nil.
Before
```
let rotationEnabledDecoded = try containerValues.decode(Swift.Bool.self, forKey: .rotationEnabled)
rotationEnabled = rotationEnabledDecoded
```
After
```
let rotationEnabledDecoded = try containerValues.decodeIfPresent(Swift.Bool.self, forKey: .rotationEnabled) ?? false
rotationEnabled = rotationEnabledDecoded
```
Copy file name to clipboardExpand all lines: smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/json/MemberShapeDecodeGenerator.kt
0 commit comments