Skip to content

fix(dynamodb): introducing symmetric marshalling/unmarshalling logic for time.Time#3356

Open
sansaid wants to merge 1 commit intoaws:mainfrom
sansaid:fix/rfc3339-timestamp-marshalling-symmetry
Open

fix(dynamodb): introducing symmetric marshalling/unmarshalling logic for time.Time#3356
sansaid wants to merge 1 commit intoaws:mainfrom
sansaid:fix/rfc3339-timestamp-marshalling-symmetry

Conversation

@sansaid
Copy link
Copy Markdown

@sansaid sansaid commented Mar 23, 2026

The marshalling logic only formats the time to a desired standard, but does not check that the output is parseable by time.Parse. We experienced an issue where we were able to persist a time with a 5 digit year, but when trying to read the record from DynamoDB, the unmarshalling failed. Ideally we should never store or marshal a record that cannot be unmarshalled. Adding protection for this by calling the parsing logic used by the decoder within the encoder and ensuring it doesn't error. This adds minor overhead when encoding structs to DynamoDB's format, but the trade off is that this protects against inserting records which can never be unmarshalled.

This is a breaking change, but open to changing this implementation so that users can add an option to invoke the check. Happy to discuss and thank you for reviewing the code in advance!

PLEASE READ BEFORE CONTINUING

DO NOT submit pull requests that directly modify generated source files, e.g. /service/s3/api_client.go. Generated source files will always include an identifying header:

// Code generated by smithy-go-codegen DO NOT EDIT.

Manual changes to these files will be overwritten by code generation that occurs as part of the daily SDK release process.

DO NOT submit pull requests that directly modify files in the /codegen/sdk-codegen/aws-models folder. These are API model files, owned by each AWS service team, that are updated automatically as part of the daily SDK release process. Local changes to these files will not persist.

If you believe the contents of any of these files need to be changed, please open an issue.

If the PR addresses an existing bug or feature, please reference it here.

To help speed up the process and reduce the time to merge please ensure that Allow edits by maintainers is checked before submitting your PR. This will allow the project maintainers to make minor adjustments or improvements to the submitted PR, allow us to reduce the roundtrip time for merging your request.

Changelog

Please DO NOT include a changelog entry in your pull request (you may see
what these look like in other PRs submitted directly by SDK team members). We
will take care of this for you.

…for time.Time

The marshalling logic only formats the time to a desired standard, but
does not check that the output is parseable by time.Parse. We
experienced an issue where we were able to persist a time with a
5 digit year, but when trying to read the record from DynamoDB, the
unmarshalling failed. Ideally we should never store or marshal a record
that cannot be unmarshalled. Adding protection for this by calling the
parsing logic used by the decoder within the encoder and ensuring it
doesn\'t error. This adds minor overhead when encoding structs to
DynamoDB\'s format, but the trade off is that this protects against
inserting records which can never be unmarshalled.

This is a breaking change, but open to changing this implementation so
that users can add an option to invoke the check. Happy to discuss and
thank you for reviewing the code in advance!
@sansaid sansaid requested a review from a team as a code owner March 23, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant