github.com/jhump/protoreflect@v1.16.0/desc/protoprint/testfiles/desc_test_comments-trailing-on-next-line.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"; 9 // Syntax trailer. 10 11 // And now the package declaration 12 package foo.bar; 13 14 // option comments FTW!!! 15 option go_package = "github.com/jhump/protoreflect/internal/testprotos"; 16 17 import public "google/protobuf/empty.proto"; 18 19 import "desc_test_options.proto"; 20 21 // Multiple white space lines (like above) cannot 22 // be preserved... 23 24 // We need a request for our RPC service below. 25 message Request { 26 option deprecated = true; 27 // deprecated! 28 29 // A field comment 30 repeated int32 ids = 1 [ 31 packed = true, 32 json_name = "|foo|", 33 (testprotos.ffubar) = "abc", 34 (testprotos.ffubarb) = "xyz" 35 ]; 36 // field trailer #1... 37 38 // lead mfubar 39 option (testprotos.mfubar) = true; 40 // trailing mfubar 41 42 // some detached comments 43 44 // some detached comments with unicode θΏδΈͺζ―εΌ 45 46 // Another field comment 47 48 // label comment 49 optional string name = 2 [default = "fubar"]; 50 51 extensions 100 to 200; 52 53 extensions 201 to 250 [ 54 (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", 55 (testprotos.exfubar) = "splat!" 56 ]; 57 58 reserved 10 to 20, 30 to 50; 59 60 reserved "foo", "bar", "baz"; 61 62 // Group comment with emoji π π π» β€ π― π₯ πΆ π¦ π₯ π» π π πͺ 63 optional group Extras = 3 { 64 // trailer for Extras 65 66 // this is a custom option 67 option (testprotos.mfubar) = false; 68 69 optional double dbl = 1; 70 71 optional float flt = 2; 72 73 option no_standard_descriptor_accessor = false; 74 75 // Leading comment... 76 optional string str = 3; 77 // Trailing comment... 78 } 79 80 enum MarioCharacters { 81 // trailer for enum 82 83 // allow_alias comments! 84 option allow_alias = true; 85 86 MARIO = 1 [ 87 (testprotos.evfubars) = -314, 88 (testprotos.evfubar) = 278 89 ]; 90 91 LUIGI = 2 [ 92 (testprotos.evfubaruf) = 100, 93 (testprotos.evfubaru) = 200 94 ]; 95 96 PEACH = 3; 97 98 BOWSER = 4; 99 100 option (testprotos.efubars) = -321; 101 102 WARIO = 5; 103 104 WALUIGI = 6; 105 106 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 107 108 HEY_HO = 7; 109 110 MAGIKOOPA = 8; 111 112 KAMEK = 8; 113 114 SNIFIT = -101; 115 116 option (testprotos.efubar) = 123; 117 } 118 119 // can be this or that 120 oneof abc { 121 // trailer for oneof abc 122 123 string this = 4; 124 125 int32 that = 5; 126 } 127 128 // can be these or those 129 oneof xyz { 130 // whoops? 131 option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377"; 132 133 string these = 6; 134 135 int32 those = 7; 136 } 137 138 // map field 139 map<string, string> things = 8; 140 } 141 142 // And next we'll need some extensions... 143 144 extend Request { 145 // trailer for extend block 146 147 // comment for guid1 148 optional uint64 guid1 = 123; 149 150 // ... and a comment for guid2 151 optional uint64 guid2 = 124; 152 } 153 154 message AnEmptyMessage { 155 } 156 157 // Service comment 158 service RpcService { 159 // service trailer 160 // that spans multiple lines 161 162 // option that sets field 163 option (testprotos.sfubar) = { id: 100, name: "bob" }; 164 165 option deprecated = false; 166 // DEPRECATED! 167 168 option (testprotos.sfubare) = VALUE; 169 170 // Method comment 171 rpc StreamingRpc ( stream Request ) returns ( Request ); 172 // compact method trailer 173 174 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 175 // trailer for method 176 177 // this RPC is deprecated! 178 option deprecated = true; 179 180 option (testprotos.mtfubar) = 12.340000; 181 182 option (testprotos.mtfubard) = 123.456000; 183 } 184 }