I would like to make map
in case class generated from protobuf wrapped in Option
case class Foo(aMap: Option[Map[String, String]])
For that I am trying to use scalapb.TypeMapper
package some.wrapper
import scalapb.TypeMapper
case class StringMapWrapper(map: Map[String, String])
object StringMapWrapper {
implicit val mapper = TypeMapper(StringMapWrapper.apply)(_.map)
}
And the proto file looks like that:
syntax = "proto3";
package some;
import "scalapb/scalapb.proto";
message Foo {
map<string, string> a_map = 1 [(scalapb.field).type = "some.wrapper.StringMapWrapper"];
}
But during compilation I have an error:
--scala_out: some.Foo.a_map: Field a_map is a map and has type specified. Use key_type or value_type instead.
How can I fix this error?