Open jrhee17 opened 2 years ago
Hi @jrhee17 - upstream defined JSON serialization for protobuf only in proto3
, not proto2
https://developers.google.com/protocol-buffers/docs/proto3#json
So this project only targets proto3 primarily and proto2 support is best effort. It was definitely quite intentional to use only numeric value setting for enums from the byte-buddy generated code because having to reference the actual Java class for the enum makes things much trickier.
When one tries to deserialize json into
proto2
with enums defined, an exception seems to be thrown. This behavior seems to differ from upstream, since onlyproto2
specific features aren't supported. I haven't gone through the code so I'm unsure how trivial the fix will be, but wanted to file an issue to record my findings.If one defines an enum in
proto2
And tries to parse
json
intoproto
the following exception is thrown
It seems like
proto2
generates stubs differently for enums