github.com/bakjos/protoreflect@v1.9.2/desc/protoprint/testfiles/desc_test_complex_source_info-compact.proto (about)

     1  syntax = "proto2";
     2  package foo.bar;
     3  import "google/protobuf/descriptor.proto";
     4  option go_package = "github.com/bakjos/protoreflect/internal/testprotos";
     5  message Simple {
     6    optional string name = 1;
     7    optional uint64 id = 2;
     8  }
     9  extend google.protobuf.ExtensionRangeOptions {
    10    optional string label = 20000;
    11  }
    12  message Test {
    13    optional string foo = 1 [json_name = "|foo|"];
    14    repeated int32 array = 2;
    15    optional Simple s = 3;
    16    repeated Simple r = 4;
    17    map<string, int32> m = 5;
    18    optional bytes b = 6 [default = "\000\001\002\003\004\005\006\007fubar!"];
    19    extensions 100 to 200;
    20    extensions 300 to 350, 500 to 550 [(label) = "jazz"];
    21    message Nested {
    22      extend google.protobuf.MessageOptions {
    23        optional int32 fooblez = 20003;
    24      }
    25      message _NestedNested {
    26        option (fooblez) = 10101;
    27        option (rept) = { foo:"goo" [foo.bar.Test.Nested._NestedNested._garblez]:"boo" };
    28        enum EEE {
    29          OK = 0;
    30          V1 = 1;
    31          V2 = 2;
    32          V3 = 3;
    33          V4 = 4;
    34          V5 = 5;
    35          V6 = 6;
    36        }
    37        extend Test {
    38          optional string _garblez = 100;
    39        }
    40        message NestedNestedNested {
    41          option (rept) = { foo:"hoo" [foo.bar.Test.Nested._NestedNested._garblez]:"spoo" };
    42          optional Test Test = 1;
    43        }
    44      }
    45    }
    46  }
    47  enum EnumWithReservations {
    48    X = 2;
    49    Y = 3;
    50    Z = 4;
    51    reserved 1000 to max, -2 to 1, 5 to 10, 12 to 15, 18, -5 to -3;
    52    reserved "C", "B", "A";
    53  }
    54  message MessageWithReservations {
    55    reserved 5 to 10, 12 to 15, 18, 1000 to max;
    56    reserved "A", "B", "C";
    57  }
    58  extend google.protobuf.MessageOptions {
    59    repeated Test rept = 20002;
    60    optional Test.Nested._NestedNested.EEE eee = 20010;
    61    optional Another a = 20020;
    62  }
    63  message Another {
    64    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 };
    65    option (eee) = V1;
    66    option (rept) = { foo:"abc" array:1 array:2 array:3 s:<name:"foo" id:123> r:<name:"f"> r:<name:"s"> r:<id:456> };
    67    option (rept) = { foo:"def" array:3 array:2 array:1 s:<name:"bar" id:321> r:<name:"g"> r:<name:"s"> };
    68    option (rept) = { foo:"def" };
    69    optional Test test = 1;
    70    optional Test.Nested._NestedNested.EEE fff = 2 [default = V1];
    71  }
    72  message Validator {
    73    optional bool authenticated = 1;
    74    enum Action {
    75      LOGIN = 0;
    76      READ = 1;
    77      WRITE = 2;
    78    }
    79    message Permission {
    80      optional Action action = 1;
    81      optional string entity = 2;
    82    }
    83    repeated Permission permission = 2;
    84  }
    85  extend google.protobuf.MethodOptions {
    86    optional Validator validator = 12345;
    87  }
    88  service TestTestService {
    89    rpc UserAuth ( Test ) returns ( Test ) {
    90      option (validator) = { authenticated:true permission:<action:LOGIN entity:"client"> };
    91    }
    92    rpc Get ( Test ) returns ( Test ) {
    93      option (validator) = { authenticated:true permission:<action:READ entity:"user"> };
    94    }
    95  }
    96  message Rule {
    97    message StringRule {
    98      optional string pattern = 1;
    99      optional bool allow_empty = 2;
   100      optional int32 min_len = 3;
   101      optional int32 max_len = 4;
   102    }
   103    message IntRule {
   104      optional int64 min_val = 1;
   105      optional uint64 max_val = 2;
   106    }
   107    message RepeatedRule {
   108      optional bool allow_empty = 1;
   109      optional int32 min_items = 2;
   110      optional int32 max_items = 3;
   111      optional Rule items = 4;
   112    }
   113    oneof rule {
   114      StringRule string = 1;
   115      RepeatedRule repeated = 2;
   116      IntRule int = 3;
   117    }
   118  }
   119  extend google.protobuf.FieldOptions {
   120    optional Rule rules = 1234;
   121  }
   122  message IsAuthorizedReq {
   123    repeated string subjects = 1 [(rules) = { repeated:<min_items:1 items:<string:<pattern:"^(?:(?:team:(?:local|ldap))|user):[[:alnum:]_-]+$">>> }];
   124  }
   125  // tests cases where field names collide with keywords
   126  message KeywordCollisions {
   127    optional bool syntax = 1;
   128    optional bool import = 2;
   129    optional bool public = 3;
   130    optional bool weak = 4;
   131    optional bool package = 5;
   132    optional string string = 6;
   133    optional bytes bytes = 7;
   134    optional int32 int32 = 8;
   135    optional int64 int64 = 9;
   136    optional uint32 uint32 = 10;
   137    optional uint64 uint64 = 11;
   138    optional sint32 sint32 = 12;
   139    optional sint64 sint64 = 13;
   140    optional fixed32 fixed32 = 14;
   141    optional fixed64 fixed64 = 15;
   142    optional sfixed32 sfixed32 = 16;
   143    optional sfixed64 sfixed64 = 17;
   144    optional bool bool = 18;
   145    optional float float = 19;
   146    optional double double = 20;
   147    optional bool optional = 21;
   148    optional bool repeated = 22;
   149    optional bool required = 23;
   150    optional bool message = 24;
   151    optional bool enum = 25;
   152    optional bool service = 26;
   153    optional bool rpc = 27;
   154    optional bool option = 28;
   155    optional bool extend = 29;
   156    optional bool extensions = 30;
   157    optional bool reserved = 31;
   158    optional bool to = 32;
   159    optional int32 true = 33;
   160    optional int32 false = 34;
   161    optional int32 default = 35;
   162  }
   163  extend google.protobuf.FieldOptions {
   164    optional bool syntax = 20001;
   165    optional bool import = 20002;
   166    optional bool public = 20003;
   167    optional bool weak = 20004;
   168    optional bool package = 20005;
   169    optional string string = 20006;
   170    optional bytes bytes = 20007;
   171    optional int32 int32 = 20008;
   172    optional int64 int64 = 20009;
   173    optional uint32 uint32 = 20010;
   174    optional uint64 uint64 = 20011;
   175    optional sint32 sint32 = 20012;
   176    optional sint64 sint64 = 20013;
   177    optional fixed32 fixed32 = 20014;
   178    optional fixed64 fixed64 = 20015;
   179    optional sfixed32 sfixed32 = 20016;
   180    optional sfixed64 sfixed64 = 20017;
   181    optional bool bool = 20018;
   182    optional float float = 20019;
   183    optional double double = 20020;
   184    optional bool optional = 20021;
   185    optional bool repeated = 20022;
   186    optional bool required = 20023;
   187    optional bool message = 20024;
   188    optional bool enum = 20025;
   189    optional bool service = 20026;
   190    optional bool rpc = 20027;
   191    optional bool option = 20028;
   192    optional bool extend = 20029;
   193    optional bool extensions = 20030;
   194    optional bool reserved = 20031;
   195    optional bool to = 20032;
   196    optional int32 true = 20033;
   197    optional int32 false = 20034;
   198    optional int32 default = 20035;
   199    optional KeywordCollisions boom = 20036;
   200  }
   201  message KeywordCollisionOptions {
   202    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];
   203    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 }];
   204  }