Support AutoGeneratedTimestamp and UpdateBehavior annotation in nested objects#6109
Conversation
eed3945 to
e2225c5
Compare
|
Please run the checkstyle plugin on When I do it by runing the following command |
|
The test coverage checklist is not complete, could you comment on the test that aren't run to validate they are not required for this change? |
Could you explain why are we also making this change? Could this impact existing customers using |
3d9ab1a to
71c57d5
Compare
Based on my understanding while debugging the code, there are two distinct ways of handling nested objects during the update flow, which depend on the IgnoreNullsMode parameter. This influences whether or not the transformItemToMapForUpdateExpression() method is invoked to flatten the request. For IgnoreNullsMode.MAPS_ONLY, the entire nested object is expected to be set as a map. In this case, UpdateExpressionUtils cannot apply if_not_exists() to individual fields annotated with @DynamoDbUpdateBehavior, since the update is applied at the object level. However, in IgnoreNullsMode.SCALAR_ONLY, where nested fields are flattened using NESTED_ATTR_UPDATE as a delimiter, if_not_exists() can be applied to each individual attribute in the final update expression. That’s how I interpret the current behavior from the code. The existing logic for parent-level attributes remains unaffected by this behavior—regardless of the IgnoreNullsMode used. This is a limitation that applies only to annotated nested fields, which were not previously supported by this extension. As such, I don’t see any breaking changes for existing use cases involving parent-level attributes. |
|
16cbb77 to
94cdb91
Compare
1ac0232 to
5de94c3
Compare
|
Builds fail with :
|
551a797 to
88a7002
Compare
15b54dc to
f1a9f76
Compare
|
Hello @L-Applin, The issue should be fixed now. We are waiting for the workflows to be approved from a maintainer. Thank you! |
re-running tests now |
|
there is still some checkstyle violations: You can run the checkstyle plugin locally with Could you try to build locally to verify all these compile time checks pass when submitting new changes? Thanks! |
6ebdd7e to
ad13d33
Compare
|
Hello @L-Applin , Sorry for that rule violation. We executed the checkstyle plugin locally and tests (incl. it tests). Could you please re-run it? |
Thanks! Rerunning unit & integ tests |
|
|
Hello @L-Applin / @alextwoods, Thank you for review! I see the bot removed the pull request from the merge queue due to failed status check. |
I have queued to merge again, but there seems to be an issue related to the maven version in Codebuild which triggers a build failure in an unrelated module of the sdk. This has affected other builds, and is not related to this PR, we are looking into it |



Description
Added support for @DynamoDbAutoGeneratedTimestampAttribute and @DynamoDbUpdateBehavior on attributes within nested objects. The @DynamoDbUpdateBehavior annotation will only take effect for nested attributes when using IgnoreNullsMode.SCALAR_ONLY.
Motivation and Context
@DynamoDbUpdateBehavior and @DynamoDbAutoGeneratedTimestampAttribute to work on nested objects too.
Modifications
The AutoGeneratedTimestampRecordExtension has been enhanced to support detection of the timestamp annotation on nested objects. Depending on the operation and the IgnoreNullsMode setting, nested attributes may either be treated as complete maps or flattened using the NESTED_ATTR_UPDATE convention (handled in transformItemToMapForUpdateExpression within UpdateItemOperation). Both scenarios are now supported, and the same generated timestamp is applied consistently across top-level and nested fields.
In parallel, the handling of the IgnoreNullsMode parameter within update requests was reviewed. As a result, UpdateExpressionUtils has been updated to evaluate the @DynamoDbUpdateBehavior annotation only when IgnoreNullsMode.SCALAR_ONLY is used, targeting flattened nested attributes identified via NESTED_ATTR_UPDATE.
When applied to a list of nested objects, the annotation is not supported, as individual elements cannot be updated — the entire list is replaced during an update operation.
Testing
Existing tests were updated, and new tests were added to validate the extended functionality.
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License
Test Coverage Checklist