aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.2k stars 853 forks source link

DynamoDB Enhanced Client Versioned Record start at 0 #5565

Open akiesler opened 2 months ago

akiesler commented 2 months ago

This allows for clients using the DynamoDB Versioned Record Extension to start their versions at 0 instead of null thus preventing clients from being required to use the Integer type and instead allowing them to use the int primitive. This change also makes the extension more flexible by allowing clients to set the starting value and incrementing value if they have a use-case to do so.

Motivation and Context

Most developers would expect a version to start at 0 and increment from their instead of having to have a special case where the value must be initialized to null (see https://github.com/aws/aws-sdk-java-v2/issues/3894).

Modifications

Updates the internal logic of VersionedRecordExtension to accept either a null value or a numeric value equal to the starting value.

Testing

Added a unit tests for explicitly setting the version to 0 during initial creation.

Screenshots (if appropriate)

Types of changes

Checklist

License