github.com/jhump/protoreflect@v1.16.0/desc/protoprint/testfiles/desc_test_complex-only-doc-comments.proto (about) 1 syntax = "proto2"; 2 3 package foo.bar; 4 5 option go_package = "github.com/jhump/protoreflect/internal/testprotos"; 6 7 import "google/protobuf/descriptor.proto"; 8 9 message Simple { 10 optional string name = 1; 11 12 optional uint64 id = 2; 13 14 optional bytes _extra = 3; 15 16 repeated bool _ = 4; 17 } 18 19 extend google.protobuf.ExtensionRangeOptions { 20 optional string label = 20000; 21 } 22 23 message Test { 24 optional string foo = 1 [json_name = "|foo|"]; 25 26 repeated int32 array = 2; 27 28 optional Simple s = 3; 29 30 repeated Simple r = 4; 31 32 map<string, int32> m = 5; 33 34 optional bytes b = 6 [default = "\000\001\002\003\004\005\006\007fubar!"]; 35 36 extensions 100 to 200; 37 38 extensions 249, 300 to 350, 500 to 550, 20000 to max [(label) = "jazz \"hands\""]; 39 40 message Nested { 41 extend google.protobuf.MessageOptions { 42 optional int32 fooblez = 20003; 43 } 44 45 message _NestedNested { 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 option (fooblez) = 10101; 63 64 extend Test { 65 optional string _garblez = 100; 66 } 67 68 option (rept) = { foo: "goo", [Test.Nested._NestedNested._garblez]: "boo" }; 69 70 message NestedNestedNested { 71 option (rept) = { foo: "hoo", [Test.Nested._NestedNested._garblez]: "spoo" }; 72 73 optional Test Test = 1; 74 } 75 } 76 } 77 } 78 79 enum EnumWithReservations { 80 X = 2; 81 82 Y = 3; 83 84 Z = 4; 85 86 reserved 1000 to max, -2 to 1, 5 to 10, 12 to 15, 18, -5 to -3; 87 88 reserved "C", "B", "A"; 89 } 90 91 message MessageWithReservations { 92 reserved 5 to 10, 12 to 15, 18, 1000 to max; 93 94 reserved "A", "B", "C"; 95 } 96 97 message MessageWithMap { 98 map<string, Simple> vals = 1; 99 } 100 101 extend google.protobuf.MessageOptions { 102 repeated Test rept = 20002; 103 104 optional Test.Nested._NestedNested.EEE eee = 20010; 105 106 optional Another a = 20020; 107 108 optional MessageWithMap map_vals = 20030; 109 } 110 111 message Another { 112 option (rept) = { 113 foo: "abc", 114 array: [ 1, 2, 3 ], 115 s: { name: "foo", id: 123 }, 116 r: [ { name: "f" }, { name: "s" }, { id: 456 } ] 117 }; 118 option (rept) = { 119 foo: "def", 120 array: [ 3, 2, 1 ], 121 s: { name: "bar", id: 321 }, 122 r: [ { name: "g" }, { name: "s" } ] 123 }; 124 option (rept) = { foo: "def" }; 125 126 option (eee) = V1; 127 128 option (a) = { 129 test: { 130 foo: "m&m", 131 array: [ 1, 2 ], 132 s: { name: "yolo", id: 98765 }, 133 m: [ 134 { key: "bar", value: 200 }, 135 { key: "foo", value: 100 } 136 ], 137 [Test.Nested._NestedNested._garblez]: "whoah!" 138 }, 139 fff: OK 140 }; 141 142 option (map_vals) = { 143 vals: [ 144 { key: "", value: { } }, 145 { key: "bar", value: { name: "baz" } }, 146 { key: "foo", value: { } } 147 ] 148 }; 149 150 optional Test test = 1; 151 152 optional Test.Nested._NestedNested.EEE fff = 2 [default = V1]; 153 } 154 155 message Validator { 156 optional bool authenticated = 1; 157 158 enum Action { 159 LOGIN = 0; 160 161 READ = 1; 162 163 WRITE = 2; 164 } 165 166 message Permission { 167 optional Action action = 1; 168 169 optional string entity = 2; 170 } 171 172 repeated Permission permission = 2; 173 } 174 175 extend google.protobuf.MethodOptions { 176 optional Validator validator = 12345; 177 } 178 179 service TestTestService { 180 rpc UserAuth ( Test ) returns ( Test ) { 181 option (validator) = { 182 authenticated: true, 183 permission: [ { action: LOGIN, entity: "client" } ] 184 }; 185 } 186 187 rpc Get ( Test ) returns ( Test ) { 188 option (validator) = { 189 authenticated: true, 190 permission: [ { action: READ, entity: "user" } ] 191 }; 192 } 193 } 194 195 message Rule { 196 message StringRule { 197 optional string pattern = 1; 198 199 optional bool allow_empty = 2; 200 201 optional int32 min_len = 3; 202 203 optional int32 max_len = 4; 204 } 205 206 message IntRule { 207 optional int64 min_val = 1; 208 209 optional uint64 max_val = 2; 210 } 211 212 message RepeatedRule { 213 optional bool allow_empty = 1; 214 215 optional int32 min_items = 2; 216 217 optional int32 max_items = 3; 218 219 optional Rule items = 4; 220 } 221 222 oneof rule { 223 StringRule string = 1; 224 225 RepeatedRule repeated = 2; 226 227 IntRule int = 3; 228 229 group FloatRule = 4 { 230 optional double min_val = 1; 231 232 optional double max_val = 2; 233 } 234 } 235 } 236 237 extend google.protobuf.FieldOptions { 238 optional Rule rules = 1234; 239 } 240 241 message IsAuthorizedReq { 242 repeated string subjects = 1 [ 243 (rules) = { 244 repeated: { 245 min_items: 1, 246 items: { 247 string: { pattern: "^(?:(?:team:(?:local|ldap))|user):[[:alnum:]_-]+$" } 248 } 249 } 250 } 251 ]; 252 } 253 254 message KeywordCollisions { 255 optional bool syntax = 1; 256 257 optional bool import = 2; 258 259 optional bool public = 3; 260 261 optional bool weak = 4; 262 263 optional bool package = 5; 264 265 optional string string = 6; 266 267 optional bytes bytes = 7; 268 269 optional int32 int32 = 8; 270 271 optional int64 int64 = 9; 272 273 optional uint32 uint32 = 10; 274 275 optional uint64 uint64 = 11; 276 277 optional sint32 sint32 = 12; 278 279 optional sint64 sint64 = 13; 280 281 optional fixed32 fixed32 = 14; 282 283 optional fixed64 fixed64 = 15; 284 285 optional sfixed32 sfixed32 = 16; 286 287 optional sfixed64 sfixed64 = 17; 288 289 optional bool bool = 18; 290 291 optional float float = 19; 292 293 optional double double = 20; 294 295 optional bool optional = 21; 296 297 optional bool repeated = 22; 298 299 optional bool required = 23; 300 301 optional bool message = 24; 302 303 optional bool enum = 25; 304 305 optional bool service = 26; 306 307 optional bool rpc = 27; 308 309 optional bool option = 28; 310 311 optional bool extend = 29; 312 313 optional bool extensions = 30; 314 315 optional bool reserved = 31; 316 317 optional bool to = 32; 318 319 optional int32 true = 33; 320 321 optional int32 false = 34; 322 323 optional int32 default = 35; 324 } 325 326 extend google.protobuf.FieldOptions { 327 optional bool syntax = 20001; 328 329 optional bool import = 20002; 330 331 optional bool public = 20003; 332 333 optional bool weak = 20004; 334 335 optional bool package = 20005; 336 337 optional string string = 20006; 338 339 optional bytes bytes = 20007; 340 341 optional int32 int32 = 20008; 342 343 optional int64 int64 = 20009; 344 345 optional uint32 uint32 = 20010; 346 347 optional uint64 uint64 = 20011; 348 349 optional sint32 sint32 = 20012; 350 351 optional sint64 sint64 = 20013; 352 353 optional fixed32 fixed32 = 20014; 354 355 optional fixed64 fixed64 = 20015; 356 357 optional sfixed32 sfixed32 = 20016; 358 359 optional sfixed64 sfixed64 = 20017; 360 361 optional bool bool = 20018; 362 363 optional float float = 20019; 364 365 optional double double = 20020; 366 367 optional bool optional = 20021; 368 369 optional bool repeated = 20022; 370 371 optional bool required = 20023; 372 373 optional bool message = 20024; 374 375 optional bool enum = 20025; 376 377 optional bool service = 20026; 378 379 optional bool rpc = 20027; 380 381 optional bool option = 20028; 382 383 optional bool extend = 20029; 384 385 optional bool extensions = 20030; 386 387 optional bool reserved = 20031; 388 389 optional bool to = 20032; 390 391 optional int32 true = 20033; 392 393 optional int32 false = 20034; 394 395 optional int32 default = 20035; 396 397 optional KeywordCollisions boom = 20036; 398 } 399 400 message KeywordCollisionOptions { 401 optional uint64 id = 1 [ 402 (syntax) = true, 403 (import) = true, 404 (public) = true, 405 (weak) = true, 406 (package) = true, 407 (string) = "string蝥\U00107F6D\007\010\014\n\r\t\013\\\"'?B", 408 (bytes) = "bytes\350\235\245\364\207\275\255\007\010\014\n\r\t\013\\\"'?B", 409 (bool) = true, 410 (float) = 3.140000, 411 (double) = 3.141590, 412 (int32) = 32, 413 (int64) = 64, 414 (uint32) = 3200, 415 (uint64) = 6400, 416 (sint32) = -32, 417 (sint64) = -64, 418 (fixed32) = 3232, 419 (fixed64) = 6464, 420 (sfixed32) = -3232, 421 (sfixed64) = -6464, 422 (optional) = true, 423 (repeated) = true, 424 (required) = true, 425 (message) = true, 426 (enum) = true, 427 (service) = true, 428 (rpc) = true, 429 (option) = true, 430 (extend) = true, 431 (extensions) = true, 432 (reserved) = true, 433 (to) = true, 434 (true) = 111, 435 (false) = -111, 436 (default) = 222 437 ]; 438 439 optional string name = 2 [ 440 (boom) = { 441 syntax: true, 442 import: true, 443 public: true, 444 weak: true, 445 package: true, 446 string: "string", 447 bytes: "bytes", 448 int32: 32, 449 int64: 64, 450 uint32: 3200, 451 uint64: 6400, 452 sint32: -32, 453 sint64: -64, 454 fixed32: 3232, 455 fixed64: 6464, 456 sfixed32: -3232, 457 sfixed64: -6464, 458 bool: true, 459 float: 3.140000, 460 double: 3.141590, 461 optional: true, 462 repeated: true, 463 required: true, 464 message: true, 465 enum: true, 466 service: true, 467 rpc: true, 468 option: true, 469 extend: true, 470 extensions: true, 471 reserved: true, 472 to: true, 473 true: 111, 474 false: -111, 475 default: 222 476 } 477 ]; 478 }