Fixed DynamoDbEnhancedClient TableSchema::itemToMap to handle null fl… #6137
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.
Fixed [DynamoDbEnhancedClient]
TableSchema::itemToMap
doesn't respect ignoreNulls with null@DynamoDbFlattened
members #2540.Description
Current behavior:
TableSchema.fromBean(Bean.class).itemToMap(bean, false)
returns a map without members of any @DynamoDbFlatten'd members if the flattened member is null even though ignoreNulls is set to false.Expected behavior:
TableSchema::itemToMap
should return a map that contains a consistent representation of null top-level (non-flattened) attributes and flattened attributes when their "parent" member is null and ignoreNulls is set to false.Motivation and Context
#2540
Modifications
Updated the
StaticImmutableTableSchema -> Map<String, AttributeValue> itemToMap(T item, boolean ignoreNulls)
logic to properly account for the ignoreNulls check and generateAttributeValue.fromNul(true)
values for attributes of@DynamoDbFlattened
members that are null.Testing
The changes have already been tested by running the existing tests and also added new unit tests for the fixed behavior.
Test Coverage Checklist
Screenshots (if appropriate)
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