I'm afraid this is not possible, because enum values can't reference other
enum values.

On Sun, Aug 30, 2020 at 11:42 PM Phani Deepak Parasuramuni <
phani...@gmail.com> wrote:

> i have a use case where a first level of proto file declares a set of enum
> values and the secondary proto file that imports the primary level proto
> file, declares another set of enum values composed using the enum values
> from first level proto file.
>
> *first.proto*:
> syntax = "proto3";
> enum Type {
>      INVALID = 0;
>      NUMERIC = 0xA0000;
>      STATE   = 0xB0000;
>      EVENT   = 0xC0000;
>      BLOB    = 0xD0000;
> };
>
> *second.proto*:
> syntax = "proto3";
> import "first.proto";
> enum ID {
>      ID_INVALID = 0;
>      ABC = NUMERIC | 0x1;
>      DEF = STATE   | 0x2;
> };
>
> when second.proto is compiled, it fails with error:
> second.proto:5:12: Expected integer.
> second.proto:6:12: Expected integer.
>
> Any suggestions on how to workaround this problem?
>
> Thanks,
> Phani
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/89989477-8bc4-48ac-9238-3d2eda0b5351n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/89989477-8bc4-48ac-9238-3d2eda0b5351n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr7TJjbU%3D8ZNa%2BpEU1sS6jUm%2Bts%2BayYGCPiAVjcxacU2mA%40mail.gmail.com.

Reply via email to