scalapb / ScalaPB

Protocol buffer compiler for Scala.
https://scalapb.github.io/
Apache License 2.0
1.3k stars 281 forks source link

sealed oneof option/annotation instead of special name #578

Open dsilvasc opened 5 years ago

dsilvasc commented 5 years ago

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?

thesamet commented 5 years ago

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

dsilvasc commented 5 years ago

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

thesamet commented 5 years ago

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

thesamet commented 5 years ago

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

wesselvdv commented 2 years ago

Was there ever any attempt for this?

acruise commented 1 month ago

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. :/