Dynamodb enhanced flattened prefixing
This pull request adds the ability for flattened beans to have a prefix attached to their flattened attributes. This enables clients to avoid conflicts in field names with flattening Beans with the same attribute name. This change supports 3 modes of setting the prefix.
- Explicitly setting the prefix on the annotation.
- Determine the prefix from the existing attribute name.
- Determine the prefix from the
@DynamoDbAttributeannotation.
Motivation and Context
We regularly use an Edit Bean containing an actor and timestamp to track both creation and updates. When flattening the fields we experience a conflict as both beans share the same attributes.
Reference: https://github.com/aws/aws-sdk-java-v2/issues/3695
Modifications
Modified Static Table Schema to enable setting the prefixes programmatically.
Modified Bean Schema builders to determine prefixes from @DynamoDbFlatten annotations.
Testing
Implemented Unit Tests to ensure that prefixing logic worked as expected.
Screenshots (if appropriate)
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
Checklist
- [X] I have read the CONTRIBUTING document
- [ ] Local run of
mvn installsucceeds - [X] My code follows the code style of this project
- [X] My change requires a change to the Javadoc documentation
- [X] I have updated the Javadoc documentation accordingly
- [X] I have added tests to cover my changes
- [X] All new and existing tests passed
- [ ] I have added a changelog entry. Adding a new entry must be accomplished by running the
scripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes. - [ ] My change is to implement 1.11 parity feature and I have updated LaunchChangelog
License
- [x] I confirm that this pull request can be released under the Apache 2 license
Build is failing because of the japicmp target. Would appreciate insights on how to address this issue.
Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.15.6:cmp (default) on project dynamodb-enhanced: There is at least one incompatibility: software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbFlatten.prefix():METHOD_ABSTRACT_ADDED_TO_CLASS
@debora-ito could you please review this feature? It seems like there is still significant interest in this feature.