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