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