github.com/jhump/protoreflect@v1.16.0/desc/protoprint/testfiles/desc_test_complex_source_info-only-doc-comments.proto (about) 1 syntax = "proto2"; 2 3 package foo.bar; 4 5 import "google/protobuf/descriptor.proto"; 6 7 option go_package = "github.com/jhump/protoreflect/internal/testprotos"; 8 9 message Simple { 10 optional string name = 1; 11 12 optional uint64 id = 2; 13 } 14 15 extend google.protobuf.ExtensionRangeOptions { 16 optional string label = 20000; 17 } 18 19 message Test { 20 optional string foo = 1 [json_name = "|foo|"]; 21 22 repeated int32 array = 2; 23 24 optional Simple s = 3; 25 26 repeated Simple r = 4; 27 28 map<string, int32> m = 5; 29 30 optional bytes b = 6 [default = "\000\001\002\003\004\005\006\007fubar!"]; 31 32 extensions 100 to 200; 33 34 extensions 300 to 350, 500 to 550 [(label) = "jazz"]; 35 36 message Nested { 37 extend google.protobuf.MessageOptions { 38 optional int32 fooblez = 20003; 39 } 40 41 message _NestedNested { 42 option (fooblez) = 10101; 43 44 option (rept) = { foo:"goo" [foo.bar.Test.Nested._NestedNested._garblez]:"boo" }; 45 46 enum EEE { 47 OK = 0; 48 49 V1 = 1; 50 51 V2 = 2; 52 53 V3 = 3; 54 55 V4 = 4; 56 57 V5 = 5; 58 59 V6 = 6; 60 } 61 62 extend Test { 63 optional string _garblez = 100; 64 } 65 66 message NestedNestedNested { 67 option (rept) = { foo:"hoo" [foo.bar.Test.Nested._NestedNested._garblez]:"spoo" }; 68 69 optional Test Test = 1; 70 } 71 } 72 } 73 } 74 75 enum EnumWithReservations { 76 X = 2; 77 78 Y = 3; 79 80 Z = 4; 81 82 reserved 1000 to max, -2 to 1, 5 to 10, 12 to 15, 18, -5 to -3; 83 84 reserved "C", "B", "A"; 85 } 86 87 message MessageWithReservations { 88 reserved 5 to 10, 12 to 15, 18, 1000 to max; 89 90 reserved "A", "B", "C"; 91 } 92 93 extend google.protobuf.MessageOptions { 94 repeated Test rept = 20002; 95 96 optional Test.Nested._NestedNested.EEE eee = 20010; 97 98 optional Another a = 20020; 99 } 100 101 message Another { 102 option (a) = { test:<foo:"m&m" array:1 array:2 s:<name:"yolo" id:98765> m:<key:"bar" value:200> m:<key:"foo" value:100>> fff:OK }; 103 104 option (eee) = V1; 105 106 option (rept) = { foo:"abc" array:1 array:2 array:3 s:<name:"foo" id:123> r:<name:"f"> r:<name:"s"> r:<id:456> }; 107 option (rept) = { foo:"def" array:3 array:2 array:1 s:<name:"bar" id:321> r:<name:"g"> r:<name:"s"> }; 108 option (rept) = { foo:"def" }; 109 110 optional Test test = 1; 111 112 optional Test.Nested._NestedNested.EEE fff = 2 [default = V1]; 113 } 114 115 message Validator { 116 optional bool authenticated = 1; 117 118 enum Action { 119 LOGIN = 0; 120 121 READ = 1; 122 123 WRITE = 2; 124 } 125 126 message Permission { 127 optional Action action = 1; 128 129 optional string entity = 2; 130 } 131 132 repeated Permission permission = 2; 133 } 134 135 extend google.protobuf.MethodOptions { 136 optional Validator validator = 12345; 137 } 138 139 service TestTestService { 140 rpc UserAuth ( Test ) returns ( Test ) { 141 option (validator) = { authenticated:true permission:<action:LOGIN entity:"client"> }; 142 } 143 144 rpc Get ( Test ) returns ( Test ) { 145 option (validator) = { authenticated:true permission:<action:READ entity:"user"> }; 146 } 147 } 148 149 message Rule { 150 message StringRule { 151 optional string pattern = 1; 152 153 optional bool allow_empty = 2; 154 155 optional int32 min_len = 3; 156 157 optional int32 max_len = 4; 158 } 159 160 message IntRule { 161 optional int64 min_val = 1; 162 163 optional uint64 max_val = 2; 164 } 165 166 message RepeatedRule { 167 optional bool allow_empty = 1; 168 169 optional int32 min_items = 2; 170 171 optional int32 max_items = 3; 172 173 optional Rule items = 4; 174 } 175 176 oneof rule { 177 StringRule string = 1; 178 179 RepeatedRule repeated = 2; 180 181 IntRule int = 3; 182 } 183 184 185 } 186 187 extend google.protobuf.FieldOptions { 188 optional Rule rules = 1234; 189 } 190 191 message IsAuthorizedReq { 192 repeated string subjects = 1 [(rules) = { repeated:<min_items:1 items:<string:<pattern:"^(?:(?:team:(?:local|ldap))|user):[[:alnum:]_-]+$">>> }]; 193 } 194 195 message KeywordCollisions { 196 optional bool syntax = 1; 197 198 optional bool import = 2; 199 200 optional bool public = 3; 201 202 optional bool weak = 4; 203 204 optional bool package = 5; 205 206 optional string string = 6; 207 208 optional bytes bytes = 7; 209 210 optional int32 int32 = 8; 211 212 optional int64 int64 = 9; 213 214 optional uint32 uint32 = 10; 215 216 optional uint64 uint64 = 11; 217 218 optional sint32 sint32 = 12; 219 220 optional sint64 sint64 = 13; 221 222 optional fixed32 fixed32 = 14; 223 224 optional fixed64 fixed64 = 15; 225 226 optional sfixed32 sfixed32 = 16; 227 228 optional sfixed64 sfixed64 = 17; 229 230 optional bool bool = 18; 231 232 optional float float = 19; 233 234 optional double double = 20; 235 236 optional bool optional = 21; 237 238 optional bool repeated = 22; 239 240 optional bool required = 23; 241 242 optional bool message = 24; 243 244 optional bool enum = 25; 245 246 optional bool service = 26; 247 248 optional bool rpc = 27; 249 250 optional bool option = 28; 251 252 optional bool extend = 29; 253 254 optional bool extensions = 30; 255 256 optional bool reserved = 31; 257 258 optional bool to = 32; 259 260 optional int32 true = 33; 261 262 optional int32 false = 34; 263 264 optional int32 default = 35; 265 } 266 267 extend google.protobuf.FieldOptions { 268 optional bool syntax = 20001; 269 270 optional bool import = 20002; 271 272 optional bool public = 20003; 273 274 optional bool weak = 20004; 275 276 optional bool package = 20005; 277 278 optional string string = 20006; 279 280 optional bytes bytes = 20007; 281 282 optional int32 int32 = 20008; 283 284 optional int64 int64 = 20009; 285 286 optional uint32 uint32 = 20010; 287 288 optional uint64 uint64 = 20011; 289 290 optional sint32 sint32 = 20012; 291 292 optional sint64 sint64 = 20013; 293 294 optional fixed32 fixed32 = 20014; 295 296 optional fixed64 fixed64 = 20015; 297 298 optional sfixed32 sfixed32 = 20016; 299 300 optional sfixed64 sfixed64 = 20017; 301 302 optional bool bool = 20018; 303 304 optional float float = 20019; 305 306 optional double double = 20020; 307 308 optional bool optional = 20021; 309 310 optional bool repeated = 20022; 311 312 optional bool required = 20023; 313 314 optional bool message = 20024; 315 316 optional bool enum = 20025; 317 318 optional bool service = 20026; 319 320 optional bool rpc = 20027; 321 322 optional bool option = 20028; 323 324 optional bool extend = 20029; 325 326 optional bool extensions = 20030; 327 328 optional bool reserved = 20031; 329 330 optional bool to = 20032; 331 332 optional int32 true = 20033; 333 334 optional int32 false = 20034; 335 336 optional int32 default = 20035; 337 338 optional KeywordCollisions boom = 20036; 339 } 340 341 message KeywordCollisionOptions { 342 optional uint64 id = 1 [(bool) = true, (bytes) = "bytes", (default) = 222, (double) = 3.141590, (enum) = true, (extend) = true, (extensions) = true, (false) = -111, (fixed32) = 3232, (fixed64) = 6464, (float) = 3.140000, (import) = true, (int32) = 32, (int64) = 64, (message) = true, (option) = true, (optional) = true, (package) = true, (public) = true, (repeated) = true, (required) = true, (reserved) = true, (rpc) = true, (service) = true, (sfixed32) = -3232, (sfixed64) = -6464, (sint32) = -32, (sint64) = -64, (string) = "string", (syntax) = true, (to) = true, (true) = 111, (uint32) = 3200, (uint64) = 6400, (weak) = true]; 343 344 optional string name = 2 [(boom) = { syntax:true import:true public:true weak:true package:true string:"string" bytes:"bytes" int32:32 int64:64 uint32:3200 uint64:6400 sint32:-32 sint64:-64 fixed32:3232 fixed64:6464 sfixed32:-3232 sfixed64:-6464 bool:true float:3.14 double:3.14159 optional:true repeated:true required:true message:true enum:true service:true rpc:true option:true extend:true extensions:true reserved:true to:true true:111 false:-111 default:222 }]; 345 }