Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Drvi opened this issue Aug 9, 2023 · 1 comment
Open

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

Drvi opened this issue Aug 9, 2023 · 1 comment

Comments

@Drvi
Copy link

Drvi commented Aug 9, 2023

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.

@findmyway
Copy link
Member

Thanks for letting us know!

I'll add a note in README later.

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

No branches or pull requests

2 participants