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