Skip to content

Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvertedBy list attributes#6854

Open
alextwoods wants to merge 2 commits intomasterfrom
alexwoo/fix_ddbe_ts_list
Open

Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvertedBy list attributes#6854
alextwoods wants to merge 2 commits intomasterfrom
alexwoo/fix_ddbe_ts_list

Conversation

@alextwoods
Copy link
Copy Markdown
Contributor

@alextwoods alextwoods commented Apr 11, 2026

Motivation and Context

Fixes #6852

PR #6546 added nested record support to AutoGeneratedTimestampRecordExtension, which recursively introspects all attributes to find @DynamoDbAutoGeneratedTimestampAttribute fields in nested types. This introspection does not respect @DynamoDbConvertedBy on list attributes — it attempts to resolve a TableSchema for the list element type even when a custom converter already handles serialization.

If the list element class is not annotated with @DynamoDbBean or @DynamoDbImmutable, TableSchema.fromClass() throws IllegalArgumentException. This is a regression for any @DynamoDbBean that has both a @DynamoDbAutoGeneratedTimestampAttribute field and a List<T> field with @DynamoDbConvertedBy where T is not a DynamoDB-annotated class.

Modifications

In NestedRecordUtils.getTableSchemaForListElement(), before calling TableSchema.fromClass() on the list element type, check whether the class has @DynamoDbBean or @DynamoDbImmutable annotations. If neither is present, return null instead of throwing. The callers in AutoGeneratedTimestampRecordExtension already handle null by skipping introspection for that attribute.

Testing

  • Added unit tests in NestedRecordUtilsTest verifying getTableSchemaForListElement returns null for non-annotated element types and that getListElementSchemaCached caches the null result.
  • Added functional tests in AutoGeneratedTimestampExtensionTest verifying beforeWrite succeeds and correctly sets the auto-generated timestamp while leaving @DynamoDbConvertedBy list and map attributes unchanged.

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

@alextwoods alextwoods changed the title Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvert… Fix AutoGeneratedTimestampRecordExtension failing on @DynamoDbConvertedBy list attributes Apr 11, 2026
@alextwoods
Copy link
Copy Markdown
Contributor Author

@anasatirbasa

@alextwoods alextwoods marked this pull request as ready for review April 11, 2026 20:27
@alextwoods alextwoods requested a review from a team as a code owner April 11, 2026 20:27
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoGeneratedTimestampRecordExtension fails on List fields with @DynamoDbConvertedBy when element type is not a DynamoDB-annotated class

2 participants