protobuf-simple icon indicating copy to clipboard operation
protobuf-simple copied to clipboard

Support for `oneOf` in messages

Open clementd-fretlink opened this issue 3 years ago • 2 comments

I'm currently using https://hackage.haskell.org/package/protobuf but would like to use protobuf-simple instead. The missing feature that's blocking me is support for oneOf within a message.

Is there planned work to support it, or maybe there is a not-obvious blocker for this?

If it's "it's not just done yet", i could work on a PR implementing it.

clementd-fretlink avatar Sep 02 '21 15:09 clementd-fretlink

Hi @clementd-fretlink,

oneOf is not implemented, because I didn't need it. What's your idea for implementing it, as a sum-type?

mrijkeboer avatar Sep 05 '21 11:09 mrijkeboer

Yes. I'm not 100% clear on how haskell identifiers are generated (in order to avoid conflicts).

The oneOf block takes a name parameter, so that could be used in combination with the message name to generate an identifier for the sum type. Same for the constructors of the sum type, that could be built from the message name + field names.

clementd-fretlink avatar Sep 06 '21 07:09 clementd-fretlink