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