Is there a way to create a type alias in protobuf (proto2)?

documentation, documentation-generation, protocol-buffers, protocols

Solution

Well this will be a bit dull answer but:

No, I'm not aware of such feature existing or having been planned.

You can sort of emulate it by making submessages that contain only a single field, but that will alter the binary representation.

You're not the first asking this though:

- Re: [protobuf] does protoc allow you to typedef a scalar ?

- Is it possible to define an alias for type (enum or message) in google protobuf?

Problem

Is it possible to create aliases of protobuf's scalar types? For example, I'd like to use `Sequence` in lieu of `string`, even though they would be binary equivalent. My immediate goal is to make documentation (generated with protoc-gen-doc) more readily understandable. Ideally, this type would be represented in languages that support type checking, but that's not necessary.

Original source

Related problems