feat(core): support kotlinx.datetime.Instant#478
Open
kangwooc wants to merge 1 commit intoavro-kotlin:mainfrom
Open
feat(core): support kotlinx.datetime.Instant#478kangwooc wants to merge 1 commit intoavro-kotlin:mainfrom
kangwooc wants to merge 1 commit intoavro-kotlin:mainfrom
Conversation
Add native support for kotlinx.datetime.Instant so users can encode and decode Kotlin Instant values without registering a contextual serializer manually. The serializer defaults to Avro timestamp-millis, supports writer-schema selection of timestamp-micros and timestamp-nanos, and still allows ISO-8601 strings through @AvroStringable. Nanos conversion uses checked arithmetic so out-of-range instants fail instead of silently wrapping into unrelated timestamps. Constraint: Issue avro-kotlin#417 requests Kotlin Instant support with timestamp millis, micros, and nanos support Constraint: binary-compatibility-validator requires the new public serializer in core/api/core.api Rejected: Keep the overflow fix as a separate review commit | the PR should present this feature as one coherent change Confidence: high Scope-risk: narrow Tested: ./gradlew :core:test --tests '*KotlinInstantEncodingTest' --tests '*KotlinInstantDecodingTest' :core:apiCheck Tested: ./gradlew check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kotlinx.datetime.Instant.timestamp-millisby default, with writer-schema support fortimestamp-micros,timestamp-nanos, and ISO-8601 strings.Testing
./gradlew :core:test --tests '*KotlinInstantEncodingTest' --tests '*KotlinInstantDecodingTest' :core:apiCheck./gradlew checkCloses #417