Skip to content

[DDB Mapper V2] Make Joda-Time an optional dependency - #7518

Merged
alextwoods merged 2 commits into
feature/master/DDB-mapperv2from
alexwoo/ddb_mapperv2_joda
Nov 9, 2026
Merged

alextwoods merged 2 commits into
feature/master/DDB-mapperv2from
alexwoo/ddb_mapperv2_joda

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Note - This branch merges to the feature branch and NOT master.

Motivation and Context

Joda-time was a dependency for the V1 mapper and was ported over. This PR makes it an optional dependency for the preview release (with a follow up task to evaluate options for GA).

Joda-time is now optional and needed only for org.joda.time.DateTime attributes and @DynamoDBTypeConvertedTimestamp. Note - if a customer has a class with a joda DateTime attribute, they will already have joda on their classpath, so these cases will continue to work.

Changes

  • MapperDateUtils formats and parses ISO-8601 dates with java.time instead of Joda-Time. Output is byte-for-byte the same as the v1 mapper's, including the fixed three-digit milliseconds, so stored Date and Calendar values and their key ordering are unchanged. Parsing accepts the same inputs as before. One difference: strings outside the range of Date now throw IllegalArgumentException, where Joda-Time silently overflowed.
  • StandardTypeConverters and StandardModelFactories no longer reference Joda-Time directly. DateTime conversions live in a nested class that loads only when JodaTimeSupport finds Joda-Time with the mapper's class loader.
  • @DynamoDBTypeConvertedTimestamp keeps Joda-Time pattern semantics through JodaTimestampConverter. Without Joda-Time it fails with a clear DynamoDBMappingException. The javadoc now says the pattern follows Joda-Time rules rather than SimpleDateFormat.
  • If the application can load Joda-Time but the mapper's class loader cannot, a DateTime attribute now fails with the same clear error instead of being written as DateTime.toString(), including into N attributes.

Tests:

  • MapperDateUtilsJodaCompatibilityTest compares the java.time implementation with the original Joda-Time one, kept as a test-only reference.
  • DynamoDBTypeConvertedTimestampTest adds unit coverage for the annotation, including a save and load against DynamoDB Local.
  • DynamoDBMapperWithoutJodaTimeTest runs in a new without-joda-time surefire execution with Joda-Time removed from the classpath, and also covers Joda-Time visible only to the application's class loader.

License

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

Joda-Time was a required dependency for every mapper user. It is now optional
and needed only for org.joda.time.DateTime attributes and
@DynamoDBTypeConvertedTimestamp.

- MapperDateUtils formats and parses ISO-8601 dates with java.time instead of
  Joda-Time. Output is byte-for-byte the same as the v1 mapper's, including the
  fixed three-digit milliseconds, so stored Date and Calendar values and their
  key ordering are unchanged. Parsing accepts the same inputs as before. One
  difference: strings outside the range of Date now throw
  IllegalArgumentException, where Joda-Time silently overflowed.
- StandardTypeConverters and StandardModelFactories no longer reference Joda-Time
  directly. DateTime conversions live in a nested class that loads only when
  JodaTimeSupport finds Joda-Time with the mapper's class loader.
- @DynamoDBTypeConvertedTimestamp keeps Joda-Time pattern semantics through
  JodaTimestampConverter. Without Joda-Time it fails with a clear
  DynamoDBMappingException. The javadoc now says the pattern follows Joda-Time
  rules rather than SimpleDateFormat.
- If the application can load Joda-Time but the mapper's class loader cannot, a
  DateTime attribute now fails with the same clear error instead of being
  written as DateTime.toString(), including into N attributes.

Tests:
- MapperDateUtilsJodaCompatibilityTest compares the java.time implementation
  with the original Joda-Time one, kept as a test-only reference.
- DynamoDBTypeConvertedTimestampTest adds unit coverage for the annotation,
  including a save and load against DynamoDB Local.
- DynamoDBMapperWithoutJodaTimeTest runs in a new without-joda-time surefire
  execution with Joda-Time removed from the classpath, and also covers Joda-Time
  visible only to the application's class loader.
@alextwoods
alextwoods requested a review from a team as a code owner November 5, 2026 18:40
@alextwoods alextwoods changed the title Make Joda-Time an optional dependency of the DynamoDB mapper [DDB Mapper V2] Make Joda-Time an optional dependency Nov 5, 2026
@alextwoods
alextwoods merged commit 6690a8f into feature/master/DDB-mapperv2 Nov 9, 2026
4 of 6 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 9, 2026
@alextwoods
alextwoods deleted the alexwoo/ddb_mapperv2_joda branch November 9, 2026 21:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants