bugfix for auto generate UUID extension #5702
Open
+45
−6
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.
Fix: AutoGenerateUUIDExtension Overriding Existing Attribute Values
Motivation and Context
The
AutoGenerateUUIDExtension
was incorrectly overriding existing UUID values for items that already contained non-empty values. This change ensures that UUIDs are only generated if the specified attribute is missing or empty.I believe that everybody wants to create a random UUID when they don't mention it and Updating the mentioned or given value didn't feel right.
This caused some major while I working on a project by using DynamoDbTable.updateItem() method. This method didn't update the existing record instead it saves a new record with auto-generated values. When I tag partition key with tag @DynamoDbAutoGeneratedUuid. I will never be able to update existing record in the Db using updateItem() method.
Fixes the issue where existing UUID attributes were being overwritten, which was not the intended behavior.
Modifications
insertUuidInItemToTransform
method to check if the key exists and if its value is non-empty before generating a new UUID.Testing
mvn install
.Testing Environment:
Screenshots (if appropriate)
N/A
Types of Changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License