ScalaPB allows you to define custom options you can use to annotate any element in a proto file, and access these annotations at run time.
Learn more about custom options.
Use the options like this:
Extensions that are defined at file scope are generated under the descriptor
proto (usually name
FileNameProto). Otherwise, the extension is defined in
the companion object of the containing class.
To access the option value of an element, you need to obtain its descriptor:
If you prefer to start with the descriptor, you use can the
The full source code of this example is available below: