smithy-lang/smithy-swift

Generating SerDe code for some timestamps doesn't use the correct timestamp format

Closed this issue · 0 comments

epau commented

Describe the bug

The generated SerDe code for some timestamps unexpectedly fails because it uses the incorrect timestamp format

Expected Behavior

The generated SerDe code runs successfully

Current Behavior

The generated SerDe code fails throwing an exception such as Expected to decode Double but found a string/data instead when attempting to encode or decode a timestamp. awslabs/aws-sdk-swift#632

Reproduction Steps

N/A

Possible Solution

It appears that there are some code paths for generating SerDe code that do not take into account the member's target. Therefore, the generated code uses the incorrect timestamp format.

The fix is to update these codepaths to the following logic:

  1. Check the traits of the member for a timestamp format
  2. Check the traits of the member's target for a timestamp format
  3. Fallback to a default timestamp format

Additional Information/Context

No response

AWS SWIFT SDK version used

0.3.1

Compiler and Version used

14.0.1

Operating System and version

MacOS 12.6