Optional fields in proto2 files
randm-ch opened this issue · 2 comments
randm-ch commented
A proto definition
message UnlockEvent {
optional string eventId = 1;
}
compiles to
final case class UnlockEvent(@_root_.pbdirect.pbIndex(1) eventId: _root_.java.lang.String)
whereas I would expect it to be
final case class UnlockEvent(@_root_.pbdirect.pbIndex(1) eventId: _root_.scala.Option[_root_.java.lang.String])
Is there an option for this (haven't found anything in the docs)? It works correctly if using another message BTW:
message EventId {
string value = 1;
}
message UnlockEvent {
optional EventId eventId = 1;
}
will result in Option[EventId]
correctly.
Using addSbtPlugin("io.higherkindness" % "sbt-mu-srcgen" % "0.26.0")
. Thanks!
fedefernandez commented
hi @randm-ch,
sbt-mu-srcgen
uses skeumorph by default for the source generation. There's an issue related to this:
You can use avrohugger for the code generation through the SBT setting key muSrcGenAvroGeneratorType
. Take a look to the documentation.
If I'm not wrong, you shouldn't have that problem with avrohugger.
randm-ch commented
Thanks for the explaination and the workaround. Closing the issue.