We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For the below protobuf snippet:
syntax = "proto2"; message Null {} message A { optional bool ignored = 1072; oneof foo { Null foo_not_set = 99999; bool bar = 1; } }
The generated json encoder function contains an error:
let rec encode_json_a_foo (v:a_foo) = begin match v with | Foo_not_set -> `Assoc [("fooNotSet", `Null)] | Bar v -> `Assoc [("bar", Pbrt_yojson.make_bool v)] end and encode_json_a (v:a) = let assoc = [] in let assoc = match v.ignored with | None -> assoc | Some v -> ("ignored", Pbrt_yojson.make_bool v) :: assoc in let assoc = match v.foo with | Foo_not_set v -> (* Error: The constructor Foo_not_set expects 0 argument(s), but is applied here to 1 argument(s) *) ("fooNotSet", `Null) :: assoc | Bar v -> ("bar", Pbrt_yojson.make_bool v) :: assoc in (* match v.foo *) `Assoc assoc
If I remove optional bool ignored from the message A, the code is generated differently and actually compiles:
optional bool ignored
A
let rec encode_json_a (v:a) = begin match v with | Foo_not_set -> `Assoc [("fooNotSet", `Null)] | Bar v -> `Assoc [("bar", Pbrt_yojson.make_bool v)] end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
For the below protobuf snippet:
The generated json encoder function contains an error:
If I remove
optional bool ignored
from the messageA
, the code is generated differently and actually compiles:The text was updated successfully, but these errors were encountered: