github.com/Big-big-orange/protoreflect@v0.0.0-20240408141420-285cedfdf6a4/desc/protoprint/testfiles/desc_test_comments-compact.proto (about) 1 // This is the first detached comment for the syntax. 2 // This is a second detached comment. 3 // This is a third. 4 // Syntax comment... 5 syntax = "proto2"; // Syntax trailer. 6 // And now the package declaration 7 package foo.bar; 8 // option comments FTW!!! 9 option go_package = "github.com/Big-big-orange/protoreflect/internal/testprotos"; 10 import public "google/protobuf/empty.proto"; 11 import "desc_test_options.proto"; 12 // Multiple white space lines (like above) cannot 13 // be preserved... 14 // We need a request for our RPC service below. 15 message Request { 16 option deprecated = true; // deprecated! 17 // A field comment 18 repeated int32 ids = 1 [packed = true, json_name = "|foo|", (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"]; // field trailer #1... 19 // lead mfubar 20 option (testprotos.mfubar) = true; // trailing mfubar 21 // some detached comments 22 // some detached comments with unicode θΏδΈͺζ―εΌ 23 // Another field comment 24 // label comment 25 optional string name = 2 [default = "fubar"]; 26 extensions 100 to 200; 27 extensions 201 to 250 [(testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", (testprotos.exfubar) = "splat!"]; 28 reserved 10 to 20, 30 to 50; 29 reserved "foo", "bar", "baz"; 30 // Group comment with emoji π π π» β€ π― π₯ πΆ π¦ π₯ π» π π πͺ 31 optional group Extras = 3 { 32 // trailer for Extras 33 // this is a custom option 34 option (testprotos.mfubar) = false; 35 optional double dbl = 1; 36 optional float flt = 2; 37 option no_standard_descriptor_accessor = false; 38 // Leading comment... 39 optional string str = 3; // Trailing comment... 40 } 41 enum MarioCharacters { 42 // trailer for enum 43 // allow_alias comments! 44 option allow_alias = true; 45 MARIO = 1 [(testprotos.evfubars) = -314, (testprotos.evfubar) = 278]; 46 LUIGI = 2 [(testprotos.evfubaruf) = 100, (testprotos.evfubaru) = 200]; 47 PEACH = 3; 48 BOWSER = 4; 49 option (testprotos.efubars) = -321; 50 WARIO = 5; 51 WALUIGI = 6; 52 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 53 HEY_HO = 7; 54 MAGIKOOPA = 8; 55 KAMEK = 8; 56 SNIFIT = -101; 57 option (testprotos.efubar) = 123; 58 } 59 // can be this or that 60 oneof abc { 61 // trailer for oneof abc 62 string this = 4; 63 int32 that = 5; 64 } 65 // can be these or those 66 oneof xyz { 67 // whoops? 68 option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377"; 69 string these = 6; 70 int32 those = 7; 71 } 72 // map field 73 map<string, string> things = 8; 74 } 75 // And next we'll need some extensions... 76 extend Request { 77 // trailer for extend block 78 // comment for guid1 79 optional uint64 guid1 = 123; 80 // ... and a comment for guid2 81 optional uint64 guid2 = 124; 82 } 83 message AnEmptyMessage { 84 } 85 // Service comment 86 service RpcService { 87 // service trailer 88 // that spans multiple lines 89 // option that sets field 90 option (testprotos.sfubar) = { id: 100, name: "bob" }; 91 option deprecated = false; // DEPRECATED! 92 option (testprotos.sfubare) = VALUE; 93 // Method comment 94 rpc StreamingRpc ( stream Request ) returns ( Request ); // compact method trailer 95 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 96 // trailer for method 97 // this RPC is deprecated! 98 option deprecated = true; 99 option (testprotos.mtfubar) = 12.340000; 100 option (testprotos.mtfubard) = 123.456000; 101 } 102 }