github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/desc/protoprint/testfiles/test-preserve-doc-comments.proto (about)

     1  syntax = "proto2";
     2  
     3  package foo.bar;
     4  
     5  option go_package = "github.com/hoveychen/protoreflect/internal/testprotos";
     6  
     7  import "google/protobuf/empty.proto";
     8  
     9  import "desc_test_options.proto";
    10  
    11  // We need a request for our RPC service below.
    12  message Request {
    13    option deprecated = true;
    14  
    15    // A field comment
    16    repeated int32 ids = 1 [packed = true, json_name = "|foo|", (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"];
    17  
    18    option (testprotos.mfubar) = true;
    19  
    20    // label comment
    21    optional string name = 2 [default = "fubar"];
    22  
    23    extensions 100 to 200;
    24  
    25    extensions 201 to 250 [(testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", (testprotos.exfubar) = "splat!"];
    26  
    27    reserved 10 to 20, 30 to 50;
    28  
    29    reserved "foo", "bar", "baz";
    30  
    31    // Group comment
    32    optional group Extras = 3 {
    33      option (testprotos.mfubar) = false;
    34  
    35      optional double dbl = 1;
    36  
    37      optional float flt = 2;
    38  
    39      option no_standard_descriptor_accessor = false;
    40  
    41      // Leading comment...
    42      optional string str = 3;
    43    }
    44  
    45    enum MarioCharacters {
    46      option allow_alias = true;
    47  
    48      MARIO = 1 [(testprotos.evfubars) = -314, (testprotos.evfubar) = 278];
    49  
    50      LUIGI = 2 [(testprotos.evfubaruf) = 100, (testprotos.evfubaru) = 200];
    51  
    52      PEACH = 3;
    53  
    54      BOWSER = 4;
    55  
    56      option (testprotos.efubars) = -321;
    57  
    58      WARIO = 5;
    59  
    60      WALUIGI = 6;
    61  
    62      SHY_GUY = 7 [(testprotos.evfubarsf) = 10101];
    63  
    64      HEY_HO = 7;
    65  
    66      MAGIKOOPA = 8;
    67  
    68      KAMEK = 8;
    69  
    70      SNIFIT = -101;
    71  
    72      option (testprotos.efubar) = 123;
    73    }
    74  
    75    // can be this or that
    76    oneof abc {
    77      string this = 4;
    78  
    79      int32 that = 5;
    80    }
    81  
    82  
    83    // can be these or those
    84    oneof xyz {
    85      string these = 6;
    86  
    87      int32 those = 7;
    88    }
    89  
    90  
    91    // map field
    92    map<string, string> things = 8;
    93  }
    94  
    95  extend Request {
    96    // comment for guid1
    97    optional uint64 guid1 = 123;
    98  
    99    // ... and a comment for guid2
   100    optional uint64 guid2 = 124;
   101  }
   102  
   103  message AnEmptyMessage {
   104  }
   105  
   106  // Service comment
   107  service RpcService {
   108    option (testprotos.sfubar) = { id:100 name:"bob"  };
   109  
   110    option deprecated = false;
   111  
   112    option (testprotos.sfubare) = VALUE;
   113  
   114    // Method comment
   115    rpc StreamingRpc ( stream Request ) returns ( Request );
   116  
   117    rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) {
   118      option deprecated = true;
   119  
   120      option (testprotos.mtfubar) = 12.340000;
   121  
   122      option (testprotos.mtfubard) = 123.456000;
   123    }
   124  }