Repository navigation
fix: preserve Kotlin mixed-object additional properties - #180
Merged
Merged
Conversation
- Retain explicit typed extension values in objects with named properties instead of silently discarding them through named-field-only Gson models. - Append defaulted mutable storage to data-class constructors so ordinary shallow copies, equality and components retain extras without shifting named components. - Keep named constructor arguments and old Java constructor entrypoints available, while documenting the need to recompile consumers after binary signatures change. - Flatten verbatim extension keys with opaque JSON precision and nulls while retaining declared model, enum, nullable, container, alias and recursive codecs. - Disambiguate storage and private factory names against authored declarations and reject extension keys that would overwrite declared or configured wire fields. - Reuse configured Gson delegates for named fields, preserving native stream/tree coercion, numeric output and ordinary null omission without leaking writer state. - Retain typed HTTP request, success and lazy error payloads alongside native consumer contracts and exact render and golden coverage. - Keep pure dictionaries, shared lowering, other languages, opaque-alias codecs, allOf, tagged-wrapper extension storage and generation formatting separate.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Preserve explicitly declared additional properties in Kotlin OkHttp objects that
also have named fields, including typed values and opaque JSON trees.
Problem
The IR retained mixed-object extension facts, but Kotlin emitted only named
properties. Ordinary Gson decoding and re-encoding silently discarded extension
entries. Pure dictionaries were already repaired in #177 and are unchanged here.
Behavior
Compatibility
Existing named constructor arguments remain valid, and secondary constructors
retain the old Java named-field entrypoints. The appended property participates
in equality, hash and component operations. It changes data-class binary
signatures: regenerate and recompile consumers instead of mixing SDK binaries.
Named fields retain native streaming/tree coercion differences, configured numeric
output and ordinary null omission. Extension null handling restores surrounding
writer settings even on failure. The runtime uses Gson 2.11.0 tree-reader/writer
implementation classes; generated dependencies are unchanged.
Only Kotlin mixed objects with explicit additional-property facts are repaired.
Pure dictionaries, closed/implicit objects, shared lowering, other languages,
opaque named-alias codecs, multi-member
allOf, tagged-wrapper extension storageand generation formatting remain separate.