Skip to content

Conversation

vbabanin
Copy link
Member

  • Add kotlinx-datetime serializers that map to BSON as the expected types.
  • Make it easily configurable via @Contextual annotation.

JAVA-5330

vbabanin added 2 commits July 26, 2024 12:37
- Add kotlinx-datetime serializers that map to BSON as the expected types.
- Make it easily configurable via `@Contextual` annotation.

JAVA-5330
JAVA-5330

implementation(platform("org.jetbrains.kotlinx:kotlinx-serialization-bom:1.5.0"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
Copy link
Member Author

@vbabanin vbabanin Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version is compatible with Kotlin versions 1.5 and later. The next version 0.5.0 requires Kotlin 1.9 or higher, as indicated by this commit:

Commit details on kotlinx-datetime

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't take a hard dependency on this library - so this will need refactoring to make it optional. #1459 adds a check for kotlinx-json support, you could use that style to add an if statement for the defaultSerializersModule

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have refactored it to make the library optional, using the approach outlined in #1459 for checking kotlinx-datetime support. Thanks!

@vbabanin vbabanin requested a review from rozza July 26, 2024 19:47
@vbabanin vbabanin self-assigned this Jul 27, 2024

implementation(platform("org.jetbrains.kotlinx:kotlinx-serialization-bom:1.5.0"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't take a hard dependency on this library - so this will need refactoring to make it optional. #1459 adds a check for kotlinx-json support, you could use that style to add an if statement for the defaultSerializersModule

@vbabanin vbabanin requested a review from rozza August 19, 2024 23:17
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just need to update the javadoc to kdoc.

@vbabanin vbabanin requested a review from rozza August 29, 2024 07:05
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More KDoc changes - then LGTM

Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! - btw I pushed some kdoc nit changes

@vbabanin vbabanin merged commit c4af1c5 into mongodb:master Aug 30, 2024
56 of 59 checks passed
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.

2 participants