ScalaPB icon indicating copy to clipboard operation
ScalaPB copied to clipboard

sealed oneof option/annotation instead of special name

Open dsilvasc opened this issue 6 years ago • 6 comments

Sealed oneofs are only generated when the oneof name is sealed_value. For people with existing schemas (or schemas shared across multi-language teams where others might prefer another name), would it be possible to allow annotating the message or the oneof?

Maybe something like option (scalapb.message).sealed_oneof = true?

dsilvasc avatar May 14 '19 01:05 dsilvasc

Yes, that should be fairly straightforward. Would you have time to put together a PR? There are initial instructions on getting started here: https://github.com/scalapb/ScalaPB/blob/master/CONTRIBUTING.md and this is an example commit that adds an option: 82bbd69965934df77969c821d0c68f99260c32b8

thesamet avatar May 14 '19 02:05 thesamet

Thanks for the pointers -- I'll give it a shot.

dsilvasc avatar May 14 '19 14:05 dsilvasc

@dsilvasc : 1. is it something that you still need? 2. Will you be able to give it a shot?

thesamet avatar Jun 10 '19 01:06 thesamet

Closing due to inactivity. Please feel free to comment if there's still interest in it and we can re-open.

thesamet avatar Jul 13 '19 14:07 thesamet

Was there ever any attempt for this?

wesselvdv avatar Apr 08 '22 08:04 wesselvdv

In cases where I control the proto and am willing to live with backwards compatibility risks, it'd be great to be able to apply sealed oneof globally, or per message, without the sealedFoo and SealedFoo naming convention leaking into the generated Scala. :/

acruise avatar Oct 02 '24 17:10 acruise