Skip to content

Conversation

@ragboyjr
Copy link

fixes several issues related to maps being encoded/decoded.


private var currentIndex = 0
override fun decodeElementIndex(descriptor: SerialDescriptor): Int {
if (currentIndex >= descriptor.elementsCount) return CompositeDecoder.DECODE_DONE
Copy link
Author

Choose a reason for hiding this comment

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

this logic only works when kind is a CLASS. if a map type, elements count is always 2 which refers to the types.

- fixed issue where empty maps couldn't be decoded properly
- fixed issue where decoding maps with more than 2 values would
  just skip everything after first entry
- added support to encode maps by keys instead of by numbers
@ragboyjr ragboyjr force-pushed the fix-empty-map-decoding branch from 16be98a to b647ce4 Compare October 29, 2025 02:34
@ragboyjr ragboyjr force-pushed the fix-empty-map-decoding branch from 8f25001 to 9374855 Compare October 29, 2025 05:15
@ragboyjr
Copy link
Author

friendly bump :)

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.

1 participant