Re: [protobuf] Defining a static message

2024-09-20 Thread 'Em Rauch' via Protocol Buffers
Unfortunately the .proto syntax doesn't currently have support for defining arbitrary constants in .proto files. There are various ways you can kinda do it, including making a proto2 syntax file and a message where every field has some default value set, and then in your code just using the default

[protobuf] Defining a static message

2024-09-11 Thread a...@binoklo.com
Hello, I'd like to do something like this: syntax = "proto3"; package foo; enum ModuleId { MODULE_ID_UNKNOWN = 0; MODULE_ID_BAR = 1; ... } message ModuleDetails { ModuleId id = 1; string name = 2; ... } message Modules { repeated ModuleDetails modules = 1; } And then define a s