github.com/bakjos/protoreflect@v1.9.2/desc/protoprint/testfiles/desc_test_comments-sorted.proto (about) 1 // Syntax comment... 2 syntax = "proto2"; // Syntax trailer. 3 4 // And now the package declaration 5 package foo.bar; 6 7 import "desc_test_options.proto"; 8 9 import public "google/protobuf/empty.proto"; 10 11 // option comments FTW!!! 12 option go_package = "github.com/bakjos/protoreflect/internal/testprotos"; 13 14 message AnEmptyMessage { 15 } 16 17 // We need a request for our RPC service below. 18 message Request { 19 option deprecated = true; // deprecated! 20 21 // lead mfubar 22 option (testprotos.mfubar) = true; // trailing mfubar 23 24 // A field comment 25 repeated int32 ids = 1 [json_name = "|foo|", packed = true, (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"]; // field trailer #1... 26 27 // label comment 28 optional string name = 2 [default = "fubar"]; 29 30 // Group comment 31 optional group Extras = 3 { 32 option no_standard_descriptor_accessor = false; 33 34 // this is a custom option 35 option (testprotos.mfubar) = false; 36 37 optional double dbl = 1; 38 39 optional float flt = 2; 40 41 // Leading comment... 42 optional string str = 3; // Trailing comment... 43 } 44 45 // can be this or that 46 oneof abc { 47 string this = 4; 48 49 int32 that = 5; 50 } 51 52 // can be these or those 53 oneof xyz { 54 string these = 6; 55 56 int32 those = 7; 57 } 58 59 // map field 60 map<string, string> things = 8; 61 62 enum MarioCharacters { 63 // allow_alias comments! 64 option allow_alias = true; 65 66 option (testprotos.efubar) = 123; 67 68 option (testprotos.efubars) = -321; 69 70 SNIFIT = -101; 71 72 MARIO = 1 [(testprotos.evfubar) = 278, (testprotos.evfubars) = -314]; 73 74 LUIGI = 2 [(testprotos.evfubaru) = 200, (testprotos.evfubaruf) = 100]; 75 76 PEACH = 3; 77 78 BOWSER = 4; 79 80 WARIO = 5; 81 82 WALUIGI = 6; 83 84 HEY_HO = 7; 85 86 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 87 88 KAMEK = 8; 89 90 MAGIKOOPA = 8; 91 } 92 93 extensions 100 to 200; 94 95 extensions 201 to 250 [(testprotos.exfubar) = "splat!", (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007"]; 96 97 reserved 10 to 20, 30 to 50; 98 99 reserved "bar", "baz", "foo"; 100 } 101 102 // Service comment 103 service RpcService { 104 option deprecated = false; // DEPRECATED! 105 106 // option that sets field 107 option (testprotos.sfubar) = { id:100 name:"bob" }; 108 109 option (testprotos.sfubare) = VALUE; 110 111 // Method comment 112 rpc StreamingRpc ( stream Request ) returns ( Request ); 113 114 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 115 option deprecated = true; 116 117 option (testprotos.mtfubar) = 12.340000; 118 119 option (testprotos.mtfubard) = 123.456000; 120 } 121 } 122 123 extend Request { 124 // comment for guid1 125 optional uint64 guid1 = 123; 126 127 // ... and a comment for guid2 128 optional uint64 guid2 = 124; 129 }