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