Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Add Map Support #5

Open
benfrew13 opened this issue Apr 12, 2017 · 2 comments
Open

Add Map Support #5

benfrew13 opened this issue Apr 12, 2017 · 2 comments

Comments

@benfrew13
Copy link

As of version 3.0.0 map fields are valid in protobuf messages. FieldUtils doesn't handle these properly, as it treats them as a standard scalar field and generates the wrong getter/setter names.

Example:

message Test {
    map<int32, string> sample = 1;
}

The correct getter and setter for sample are putAllSample and 'getSampleMap`.

This change appears to be sufficient to get maps with scalar types for keys and values, but protobufs also allows nested complex types for values.

message Test {
    map<int32, Nested> complexField = 1;
}

message Nested {
    string name = 1;
}

It looks like both the default Mapper and Converter would need work to support this new category of fields.

@jsjem
Copy link
Collaborator

jsjem commented Apr 13, 2017

Good point. I will try to add map fields support.

djotanov pushed a commit to djotanov/protobuf-converter that referenced this issue Apr 23, 2018
djotanov pushed a commit to djotanov/protobuf-converter that referenced this issue Apr 23, 2018
@djotanov
Copy link

I've created PR which adds support for the map type. Could you please review?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants