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

Maps in proto2 files #43

Closed
eiennohito opened this issue Sep 17, 2015 · 2 comments
Closed

Maps in proto2 files #43

eiennohito opened this issue Sep 17, 2015 · 2 comments

Comments

@eiennohito
Copy link
Contributor

It seems to be possible according to the docs (https://developers.google.com/protocol-buffers/docs/proto?hl=en#oneof), however codegen generated invalid messages.

for simple message like

syntax = "proto2";

message MapTest {
  map<string, int32> map1 = 1;
  map<string, float> map2 = 2;
}

it generates map entries like case class (key: Option[String], value: Option[Int]), but the type of map is Map[String, Int]. I believe that options are not needed here.

@thesamet
Copy link
Contributor

If you switch to syntax="proto3" it will work as you expect. For syntax="proto2" it needs to be this way for backward compatibility.

@eiennohito
Copy link
Contributor Author

For proto3 I believe that #40 still holds and there should be a mean for not wrapping fields in options.

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