fix(util): round-trip null Value in ValueOrCompletion serialization#47
Merged
Merged
Conversation
A materialized Flow<T?> that emits null produces Value(null), but none of the serializers could round-trip it: - Fory force-cast the read ref to non-null Any (NullPointerException). - The Jackson 2/3 deserializers conflated an absent value field with a present-but-null one, throwing "Missing value field" on "value": null. Drop the Fory non-null cast, and in both Jackson deserializers throw only when the field is genuinely absent, treating a present null node as null. Adds a null-Value round-trip test to each serialization spec.
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
A materialized
Flow<T?>that emitsnullproducesValueOrCompletion.Value(null), but none of the three serializers could round-trip it. Adding the missing null-value tests surfaced the bug across all backends.NullPointerException—readRef() as Anyforce-casts a null ref to non-nullAnyJsonMappingException"Missing value field"DatabindException"Missing value field"The Jackson deserializers conflated field absent with field present but null (
node.get("value")?.let{…} ?: throw), so a serialized"value": nullwas rejected on read.Changes
ValueOrCompletionSerializer— drop theas Anynon-null cast on read.ValueOrCompletionDeserializer— throw only when thevaluefield is genuinely absent; treat a present null node as a realnull.Value (null)round-trip test to each of the fory / jackson2 / jackson3 serialization specs.Notes
internalserializer classes;ValueOrCompletion's public surface is unchanged.apiCheckpasses with no.apidiff — patch-level bug fix../gradlew :datasourcex-util:checkpasses (tests, apiCheck, spotlessCheck, koverVerify).