github.com/jhump/protoreflect@v1.16.0/desc/protoprint/testfiles/test-non-files-full.txt (about) 1 -------- desc_test_comments.proto (*desc.FileDescriptor) -------- 2 // This is the first detached comment for the syntax. 3 4 // This is a second detached comment. 5 6 // This is a third. 7 8 // Syntax comment... 9 syntax = "proto2"; // 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 with a capital R */ Request /* trailer */ { 26 option deprecated = true; // deprecated! 27 28 // A field comment 29 repeated int32 ids = /* tag numero uno */ 1 /* 30 * tag trailer 31 * that spans multiple lines... 32 * more than two. 33 */ [ 34 packed = true, 35 // packed! 36 json_name = "|foo|", 37 // custom JSON! 38 (testprotos.ffubar) = "abc", 39 (testprotos.ffubarb) = "xyz" 40 ]; // field trailer #1... 41 42 // lead mfubar 43 option (testprotos.mfubar) = true; // trailing mfubar 44 45 // some detached comments 46 47 // some detached comments with unicode θΏδΈͺζ―εΌ 48 49 // Another field comment 50 51 // label comment 52 optional /* type comment */ string /* name comment */ name = 2 [ 53 // default lead 54 55 default = "fubar" // default trail 56 ]; 57 58 extensions 100 to 200; 59 60 extensions 201 to 250 [ 61 (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", 62 (testprotos.exfubar) = "splat!" 63 ]; 64 65 reserved 10 to 20, 30 to 50; 66 67 reserved "foo", "bar", "baz"; 68 69 // Group comment with emoji π π π» β€ π― π₯ πΆ π¦ π₯ π» π π πͺ 70 optional group Extras = 3 { 71 // trailer for Extras 72 73 // this is a custom option 74 option (testprotos.mfubar) = false; 75 76 optional double dbl = 1; 77 78 optional float flt = 2; 79 80 option no_standard_descriptor_accessor = false; 81 82 // Leading comment... 83 optional string str = 3; // Trailing comment... 84 } 85 86 enum MarioCharacters /* "super"! */ { 87 // trailer for enum 88 89 // allow_alias comments! 90 option allow_alias = true; 91 92 MARIO = 1 [ 93 (testprotos.evfubars) = -314, 94 (testprotos.evfubar) = 278 95 ]; 96 97 LUIGI = 2 [ 98 (testprotos.evfubaruf) = 100, 99 // swoosh! 100 101 (testprotos.evfubaru) = 200 102 ]; 103 104 PEACH = 3; 105 106 BOWSER = 4; 107 108 option (testprotos.efubars) = -321; 109 110 WARIO = 5; 111 112 WALUIGI = 6; 113 114 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 115 116 HEY_HO = 7; 117 118 MAGIKOOPA = 8; 119 120 KAMEK = 8; 121 122 SNIFIT = -101; 123 124 option (testprotos.efubar) = 123; 125 } 126 127 // can be this or that 128 oneof abc { 129 // trailer for oneof abc 130 131 string this = 4; 132 133 int32 that = 5; 134 } 135 136 // can be these or those 137 oneof xyz { 138 // whoops? 139 option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377"; 140 141 string these = 6; 142 143 int32 those = 7; 144 } 145 146 // map field 147 map<string, string> things = 8; 148 } 149 150 // And next we'll need some extensions... 151 152 extend /* extendee comment */ Request { 153 // trailer for extend block 154 155 // comment for guid1 156 optional uint64 guid1 = 123; 157 158 // ... and a comment for guid2 159 optional uint64 guid2 = 124; 160 } 161 162 message /* name leading comment */ AnEmptyMessage { 163 // trailer for AnEmptyMessage 164 165 } 166 167 // Service comment 168 service /* service name */ RpcService { 169 // service trailer 170 // that spans multiple lines 171 172 // option that sets field 173 option (testprotos.sfubar) = { id: 100, name: "bob" }; 174 175 option deprecated = false; // DEPRECATED! 176 177 option (testprotos.sfubare) = VALUE; 178 179 // Method comment 180 rpc /* rpc name */ StreamingRpc ( /* comment C */ stream Request ) returns ( /*comment E */ Request ); // compact method trailer 181 182 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 183 // trailer for method 184 185 // this RPC is deprecated! 186 option deprecated = true; 187 188 option (testprotos.mtfubar) = 12.340000; 189 190 option (testprotos.mtfubard) = 123.456000; 191 } 192 } 193 -------- foo.bar.Request (*desc.MessageDescriptor) -------- 194 // Multiple white space lines (like above) cannot 195 // be preserved... 196 197 // We need a request for our RPC service below. 198 message /* request with a capital R */ Request /* trailer */ { 199 option deprecated = true; // deprecated! 200 201 // A field comment 202 repeated int32 ids = /* tag numero uno */ 1 /* 203 * tag trailer 204 * that spans multiple lines... 205 * more than two. 206 */ [ 207 packed = true, 208 // packed! 209 json_name = "|foo|", 210 // custom JSON! 211 (testprotos.ffubar) = "abc", 212 (testprotos.ffubarb) = "xyz" 213 ]; // field trailer #1... 214 215 // lead mfubar 216 option (testprotos.mfubar) = true; // trailing mfubar 217 218 // some detached comments 219 220 // some detached comments with unicode θΏδΈͺζ―εΌ 221 222 // Another field comment 223 224 // label comment 225 optional /* type comment */ string /* name comment */ name = 2 [ 226 // default lead 227 228 default = "fubar" // default trail 229 ]; 230 231 extensions 100 to 200; 232 233 extensions 201 to 250 [ 234 (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", 235 (testprotos.exfubar) = "splat!" 236 ]; 237 238 reserved 10 to 20, 30 to 50; 239 240 reserved "foo", "bar", "baz"; 241 242 // Group comment with emoji π π π» β€ π― π₯ πΆ π¦ π₯ π» π π πͺ 243 optional group Extras = 3 { 244 // trailer for Extras 245 246 // this is a custom option 247 option (testprotos.mfubar) = false; 248 249 optional double dbl = 1; 250 251 optional float flt = 2; 252 253 option no_standard_descriptor_accessor = false; 254 255 // Leading comment... 256 optional string str = 3; // Trailing comment... 257 } 258 259 enum MarioCharacters /* "super"! */ { 260 // trailer for enum 261 262 // allow_alias comments! 263 option allow_alias = true; 264 265 MARIO = 1 [ 266 (testprotos.evfubars) = -314, 267 (testprotos.evfubar) = 278 268 ]; 269 270 LUIGI = 2 [ 271 (testprotos.evfubaruf) = 100, 272 // swoosh! 273 274 (testprotos.evfubaru) = 200 275 ]; 276 277 PEACH = 3; 278 279 BOWSER = 4; 280 281 option (testprotos.efubars) = -321; 282 283 WARIO = 5; 284 285 WALUIGI = 6; 286 287 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 288 289 HEY_HO = 7; 290 291 MAGIKOOPA = 8; 292 293 KAMEK = 8; 294 295 SNIFIT = -101; 296 297 option (testprotos.efubar) = 123; 298 } 299 300 // can be this or that 301 oneof abc { 302 // trailer for oneof abc 303 304 string this = 4; 305 306 int32 that = 5; 307 } 308 309 // can be these or those 310 oneof xyz { 311 // whoops? 312 option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377"; 313 314 string these = 6; 315 316 int32 those = 7; 317 } 318 319 // map field 320 map<string, string> things = 8; 321 } 322 -------- foo.bar.Request.ids (*desc.FieldDescriptor) -------- 323 // A field comment 324 repeated int32 ids = /* tag numero uno */ 1 /* 325 * tag trailer 326 * that spans multiple lines... 327 * more than two. 328 */ [ 329 packed = true, 330 // packed! 331 json_name = "|foo|", 332 // custom JSON! 333 (testprotos.ffubar) = "abc", 334 (testprotos.ffubarb) = "xyz" 335 ]; // field trailer #1... 336 -------- foo.bar.Request.name (*desc.FieldDescriptor) -------- 337 // some detached comments 338 339 // some detached comments with unicode θΏδΈͺζ―εΌ 340 341 // Another field comment 342 343 // label comment 344 optional /* type comment */ string /* name comment */ name = 2 [ 345 // default lead 346 347 default = "fubar" // default trail 348 ]; 349 -------- foo.bar.Request.extras (*desc.FieldDescriptor) -------- 350 // Group comment with emoji π π π» β€ π― π₯ πΆ π¦ π₯ π» π π πͺ 351 optional group Extras = 3 { 352 // trailer for Extras 353 354 // this is a custom option 355 option (testprotos.mfubar) = false; 356 357 optional double dbl = 1; 358 359 optional float flt = 2; 360 361 option no_standard_descriptor_accessor = false; 362 363 // Leading comment... 364 optional string str = 3; // Trailing comment... 365 } 366 -------- foo.bar.Request.this (*desc.FieldDescriptor) -------- 367 string this = 4; 368 -------- foo.bar.Request.that (*desc.FieldDescriptor) -------- 369 int32 that = 5; 370 -------- foo.bar.Request.these (*desc.FieldDescriptor) -------- 371 string these = 6; 372 -------- foo.bar.Request.those (*desc.FieldDescriptor) -------- 373 int32 those = 7; 374 -------- foo.bar.Request.things (*desc.FieldDescriptor) -------- 375 // map field 376 map<string, string> things = 8; 377 -------- foo.bar.Request.abc (*desc.OneOfDescriptor) -------- 378 oneof abc { 379 string this = 4; 380 381 int32 that = 5; 382 } 383 -------- foo.bar.Request.xyz (*desc.OneOfDescriptor) -------- 384 oneof xyz { 385 option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377"; 386 387 string these = 6; 388 389 int32 those = 7; 390 } 391 -------- foo.bar.Request.Extras (*desc.MessageDescriptor) -------- 392 // Group comment with emoji π π π» β€ π― π₯ πΆ π¦ π₯ π» π π πͺ 393 message /* group name */ Extras { 394 // trailer for Extras 395 396 // this is a custom option 397 option (testprotos.mfubar) = false; 398 399 optional double dbl = 1; 400 401 optional float flt = 2; 402 403 option no_standard_descriptor_accessor = false; 404 405 // Leading comment... 406 optional string str = 3; // Trailing comment... 407 } 408 -------- foo.bar.Request.Extras.dbl (*desc.FieldDescriptor) -------- 409 optional double dbl = 1; 410 -------- foo.bar.Request.Extras.flt (*desc.FieldDescriptor) -------- 411 optional float flt = 2; 412 -------- foo.bar.Request.Extras.str (*desc.FieldDescriptor) -------- 413 // Leading comment... 414 optional string str = 3; // Trailing comment... 415 -------- foo.bar.Request.ThingsEntry (*desc.MessageDescriptor) -------- 416 message ThingsEntry { 417 option map_entry = true; 418 419 optional string key = 1; 420 421 optional string value = 2; 422 } 423 -------- foo.bar.Request.ThingsEntry.key (*desc.FieldDescriptor) -------- 424 optional string key = 1; 425 -------- foo.bar.Request.ThingsEntry.value (*desc.FieldDescriptor) -------- 426 optional string value = 2; 427 -------- foo.bar.Request.MarioCharacters (*desc.EnumDescriptor) -------- 428 enum MarioCharacters /* "super"! */ { 429 // trailer for enum 430 431 // allow_alias comments! 432 option allow_alias = true; 433 434 MARIO = 1 [ 435 (testprotos.evfubars) = -314, 436 (testprotos.evfubar) = 278 437 ]; 438 439 LUIGI = 2 [ 440 (testprotos.evfubaruf) = 100, 441 // swoosh! 442 443 (testprotos.evfubaru) = 200 444 ]; 445 446 PEACH = 3; 447 448 BOWSER = 4; 449 450 option (testprotos.efubars) = -321; 451 452 WARIO = 5; 453 454 WALUIGI = 6; 455 456 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 457 458 HEY_HO = 7; 459 460 MAGIKOOPA = 8; 461 462 KAMEK = 8; 463 464 SNIFIT = -101; 465 466 option (testprotos.efubar) = 123; 467 } 468 -------- foo.bar.Request.MarioCharacters.MARIO (*desc.EnumValueDescriptor) -------- 469 MARIO = 1 [ 470 (testprotos.evfubars) = -314, 471 (testprotos.evfubar) = 278 472 ]; 473 -------- foo.bar.Request.MarioCharacters.LUIGI (*desc.EnumValueDescriptor) -------- 474 LUIGI = 2 [ 475 (testprotos.evfubaruf) = 100, 476 // swoosh! 477 478 (testprotos.evfubaru) = 200 479 ]; 480 -------- foo.bar.Request.MarioCharacters.PEACH (*desc.EnumValueDescriptor) -------- 481 PEACH = 3; 482 -------- foo.bar.Request.MarioCharacters.BOWSER (*desc.EnumValueDescriptor) -------- 483 BOWSER = 4; 484 -------- foo.bar.Request.MarioCharacters.WARIO (*desc.EnumValueDescriptor) -------- 485 WARIO = 5; 486 -------- foo.bar.Request.MarioCharacters.WALUIGI (*desc.EnumValueDescriptor) -------- 487 WALUIGI = 6; 488 -------- foo.bar.Request.MarioCharacters.SHY_GUY (*desc.EnumValueDescriptor) -------- 489 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 490 -------- foo.bar.Request.MarioCharacters.HEY_HO (*desc.EnumValueDescriptor) -------- 491 HEY_HO = 7; 492 -------- foo.bar.Request.MarioCharacters.MAGIKOOPA (*desc.EnumValueDescriptor) -------- 493 MAGIKOOPA = 8; 494 -------- foo.bar.Request.MarioCharacters.KAMEK (*desc.EnumValueDescriptor) -------- 495 KAMEK = 8; 496 -------- foo.bar.Request.MarioCharacters.SNIFIT (*desc.EnumValueDescriptor) -------- 497 SNIFIT = -101; 498 -------- foo.bar.AnEmptyMessage (*desc.MessageDescriptor) -------- 499 message /* name leading comment */ AnEmptyMessage { 500 // trailer for AnEmptyMessage 501 502 } 503 -------- foo.bar.guid1 (*desc.FieldDescriptor) -------- 504 extend /* extendee comment */ Request { 505 // comment for guid1 506 optional uint64 guid1 = 123; 507 } 508 -------- foo.bar.guid2 (*desc.FieldDescriptor) -------- 509 extend Request { 510 // ... and a comment for guid2 511 optional uint64 guid2 = 124; 512 } 513 -------- foo.bar.RpcService (*desc.ServiceDescriptor) -------- 514 // Service comment 515 service /* service name */ RpcService { 516 // service trailer 517 // that spans multiple lines 518 519 // option that sets field 520 option (testprotos.sfubar) = { id: 100, name: "bob" }; 521 522 option deprecated = false; // DEPRECATED! 523 524 option (testprotos.sfubare) = VALUE; 525 526 // Method comment 527 rpc /* rpc name */ StreamingRpc ( /* comment C */ stream Request ) returns ( /*comment E */ Request ); // compact method trailer 528 529 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 530 // trailer for method 531 532 // this RPC is deprecated! 533 option deprecated = true; 534 535 option (testprotos.mtfubar) = 12.340000; 536 537 option (testprotos.mtfubard) = 123.456000; 538 } 539 } 540 -------- foo.bar.RpcService.StreamingRpc (*desc.MethodDescriptor) -------- 541 // Method comment 542 rpc /* rpc name */ StreamingRpc ( /* comment C */ stream Request ) returns ( /*comment E */ Request ); // compact method trailer 543 -------- foo.bar.RpcService.UnaryRpc (*desc.MethodDescriptor) -------- 544 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 545 // trailer for method 546 547 // this RPC is deprecated! 548 option deprecated = true; 549 550 option (testprotos.mtfubar) = 12.340000; 551 552 option (testprotos.mtfubard) = 123.456000; 553 }