esensar / kotlinx-serialization-msgpack

MsgPack support for kotlinx.serialization -- msgpack.org[kotlinx.serialization]
https://www.ensarsarajcic.com/kotlinx-serialization-msgpack/
MIT License
44 stars 9 forks source link

double serialization in BaseMsgPackExtensionSerializer #92

Closed krisbitney closed 1 year ago

krisbitney commented 1 year ago

The serialize method in BaseMsgPackExtensionSerializer serializes the value twice.

    override fun serialize(encoder: Encoder, value: T) {
        val extension = serialize(value) // FIRST SERIALIZATION
        if (checkTypeId && extension.extTypeId != extTypeId) {
            throw MsgPackSerializationException.extensionSerializationWrongType(extension, extTypeId, extension.extTypeId)
        }
        encoder.encodeSerializableValue(serializer, serialize(value)) // SECOND SERIALIZATION
    }

I tried to create a PR but got an "access denied" error.

esensar commented 1 year ago

Thank you for reporting this!

To open a PR, you need to fork the repo: https://docs.github.com/en/get-started/quickstart/contributing-to-projects

I will gladly accept your PR with this fix!