Repository navigation
fix(kotlin): keep null-valued columns when casting response data - #2105
Merged
Merged
Conversation
jsonCast() round-tripped through the default Gson, which omits nulls, so Row.data and Document.data on Android and Kotlin lost every column whose value is null. A null column then read the same as one the query did not select, and the joined columns of an unmatched left join vanished instead of reading null. Realtime payload casts lost null fields the same way. Every other SDK keeps them. jsonCast() now serializes with the null-preserving Gson already used for request bodies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🟢 Tier S · Ready to merge
The Kotlin and Android templates now serialize Latest changes: The newest commits replace the Row-model-specific test cases with nested response-data map casts, avoiding a dependency on a generated
📂 Walkthrough · 6
Reviewed the commits since |
The generator's test spec has no Row model, so the test casts the data map Row.from() hands to jsonCast() directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
jsonCast()in the Android and Kotlin templates now serializes withrequestGson, which callsserializeNulls(), instead of the defaultgson.JsonCastTestin both SDKs.Why
jsonCast()buildsRow.data/Document.datafrom the response map, and it used the default Gson, which omits nulls. So on Android and Kotlin a column whose value isnulldisappeared fromrow.data:note: nullread the same as a row whose query never selectednote.c.name) instead of returning them asnull.jsonCast()lost null fields the same way.Web, Node, Python, PHP, Dart, React Native and Apple all keep them.
Found while running the query-lib case suite, 47 cases plus a builder chain, through every popular SDK against server-ce
main. Every SDK except Android matched the web SDK exactly. Android differed only in null-valued keys:noteon 40 rows, andc.name/customers.nameon unmatched left-join rows.Before / after
mainJsonCastTest(Kotlin, JVM)AssertionErrorat thecontainsKeychecks)JsonCastTest(Android, JVM unit)AssertionErrorat thecontainsKeychecks)mainktlint 1.8.0 is clean on the generated Kotlin and Android SDKs.
🤖 Generated with Claude Code