fix(dynamodb): introducing symmetric marshalling/unmarshalling logic for time.Time#3356
Open
fix(dynamodb): introducing symmetric marshalling/unmarshalling logic for time.Time#3356
Conversation
…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!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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: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-modelsfolder. 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 maintainersis 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.