issuu / ocaml-protoc-plugin

ocaml-protoc-plugin
https://issuu.github.io/ocaml-protoc-plugin/
Other
48 stars 19 forks source link

Support proto3 optional by default #32

Closed AndreasDahl closed 2 years ago

andersfugmann commented 2 years ago

Is the optional field even supported by the version3 protocol spec? I cannot find it in https://developers.google.com/protocol-buffers/docs/reference/proto3-spec

Looking into this further, it seems that proto3 will translate optional fields into single field oneof. Would it make sense to map proto3 fields into an optional type instead of a polymorphic variant? I have a PR ready to do that if you like.

AndreasDahl commented 2 years ago

Yes. I would love that. It should be a major release though, didn't have time to look at it myself at this time. If you have such a PR, I would much appreciate it. Otherwise i will get to it at a later date.