Skip to content

Encoding of ProtoBuf map fields will change in the next release #28

@Drvi

Description

@Drvi

Hello,
Recently, it was noticed that the ProtoBuf.jl package v1.0+ doesn't encode map fields the way the spec requires (see JuliaIO/ProtoBuf.jl#233), meaning that our map fields would serialize and deserialize fine in ProtoBuf.jl v1.0+, but not with other ProtoBuf implementations. Specifically, we weren't treating the map as an array of messages, each containing two fields, but as a "packed" array of interleaved keys and values.

This is a bug and we are close to fixing it here: JuliaIO/ProtoBuf.jl#234. We'll release the fix as a new patch version, hopefully later this week. This might break compatibility with older files your package has produced since you are using map fields.

If you have some older files that are not easy to re-create and you'd like to convert to the new encoding here is a possible way to achieve that:
a) Decode the file using a compatible ProtoBuf.jl package version
b) write the struct to disk using Serialization.jl (or other appropriate format)
then, in a new session
c) read the struct from disk using Serialization.jl
d) Encode struct to disk using the new ProtoBuf.jl package with fixed map encoding

I'm very sorry for this inconvenience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions