ocaml-protoc icon indicating copy to clipboard operation
ocaml-protoc copied to clipboard

Crash compiling Yojson use of empty messages

Open vphantom opened this issue 2 years ago • 0 comments

Hi! Thank you for your work. :smile: When compiling the use of an empty message, i.e.:

message Empty {}  // This line is fine
message Test {
  Empty empty = 1;  // This crashes
}

…I get a crash in Yojson mode:

$ ocaml-protoc -binary -yojson -ml_out . test.proto
Generating ./test_types.mli
Generating ./test_types.ml
File "src/compilerlib/pb_codegen_decode_yojson.ml", line 31, characters 18-24: Assertion failed

Indeed, that's https://github.com/mransan/ocaml-protoc/blob/master/src/compilerlib/pb_codegen_decode_yojson.ml#L31

I know that the JSON representation should be an empty object (i.e. `Assoc []) but not to the point of knowing how to contribute this. 😕

vphantom avatar Dec 09 '21 21:12 vphantom