Skip to content

Conversation

@anasatirbasa
Copy link
Contributor

@anasatirbasa anasatirbasa commented May 14, 2025

Added the facility of using an annotation that will flatten a map of attributes in a class,
similar to what @DynamoDbFlatten does for attributes from another class.

Description

Added a new annotation named DynamoDbFlattenMap that can be applied at method level for only a single map of attributes within a class (Map<String, String>). If used on multiple maps of attributes, the serialization will throw an exception.

Motivation and Context

#2542

Modifications

Followed the same approach as for DybamoDbFlatten annotation, that is used to flatten all the attributes of a separate DynamoDb bean that is stored in the current bean

Testing

The changes have already been tested by running the existing tests and also added new unit/integration tests for the new flow.

Test Coverage Checklist

Scenario Done Comments if Not Done
1. Different TableSchema Creation Methods
a. TableSchema.fromBean(Customer.class) [x]
b. TableSchema.fromImmutableClass(Customer.class) for immutable classes [x]
c. TableSchema.documentSchemaBuilder().build() [ ]
d. StaticTableSchema.builder(Customer.class) [x]
2. Nesting of Different TableSchema Types
a. @DynamoDbBean with nested @DynamoDbBean as NonNull [x]
b. @DynamoDbBean with nested @DynamoDbImmutable as NonNull [x]
c. @DynamoDbImmutable with nested @DynamoDbBean as NonNull [x]
d. @DynamoDbBean with nested @DynamoDbBean as Null [x]
e. @DynamoDbBean with nested @DynamoDbImmutable as Null [x]
f. @DynamoDbImmutable with nested @DynamoDbBean as Null [x]
3. CRUD Operations
a. scan() [ ]
b. query() [x]
c. updateItem() [x]
d. putItem() [x]
e. getItem() [x]
f. deleteItem() [ ]
g. batchGetItem() [ ]
h. batchWriteItem() [ ]
i. transactGetItems() [ ]
j. transactWriteItems() [ ]
4. Data Types and Null Handling
a. top-level null attributes [x]
b. collections with null elements [x]
c. maps with null values [x]
d. conversion between null Java values and AttributeValue [ ]
e. full serialization/deserialization cycle with null values [ ]
5. AsyncTable and SyncTable
a. DynamoDbAsyncTable Testing [ ]
b. DynamoDbTable Testing [ ]
6. New/Modification in Extensions
a. Tables with Scenario in ScenarioSl No.1 (All table schemas are Must) [ ]
b. Test with Default Values in Annotations [ ]
c. Combination of Annotation and Builder passes extension [ ]
7. New/Modification in Converters
a. Tables with Scenario in ScenarioSl No.1 (All table schemas are Must) [ ]
b. Test with Default Values in Annotations [ ]
c. Test All Scenarios from 1 to 5 [ ]

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@anasatirbasa anasatirbasa requested a review from a team as a code owner May 14, 2025 07:25
@anasatirbasa anasatirbasa force-pushed the feature/support-to-flatten-a-map branch 9 times, most recently from 25598b0 to fab983f Compare May 23, 2025 11:48
@anasatirbasa anasatirbasa force-pushed the feature/support-to-flatten-a-map branch from fab983f to b0979f4 Compare May 27, 2025 11:09
@anasatirbasa anasatirbasa force-pushed the feature/support-to-flatten-a-map branch from e438149 to 247d722 Compare September 30, 2025 06:21
@anasatirbasa
Copy link
Contributor Author

Hello @alextwoods,

Thank you very much for your feedback, we have addressed the comments from the pull request.

After further analysis, we changed from the original proposal of separate annotations to a unified @DynamoDbFlatten approach that handles both objects and maps. We chose this design for better API consistency. You can find the updated Solution Proposal here.

Could you please review this approach and provide your feedback?
Thank you very much!

@alextwoods
Copy link
Contributor

It looks like checkstyle is failing - make sure you run checkstyle locally.

@anasatirbasa anasatirbasa force-pushed the feature/support-to-flatten-a-map branch from 19768ac to 6389bd2 Compare October 15, 2025 16:26
@anasatirbasa anasatirbasa force-pushed the feature/support-to-flatten-a-map branch from 0ce264a to c2a145b Compare October 15, 2025 16:34
@anasatirbasa
Copy link
Contributor Author

Hello @alextwoods,

Thank you very much for the review! I have addressed the comments raised and resolved the checkstyle issues.
Could you please take another look when you have a chance? Thank you!

@alextwoods alextwoods enabled auto-merge October 17, 2025 16:24
@alextwoods alextwoods added the no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required label Oct 29, 2025
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
6.8% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@alextwoods alextwoods added this pull request to the merge queue Oct 29, 2025
Merged via the queue into aws:master with commit f0059f1 Oct 29, 2025
20 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants