github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/desc/protoprint/testfiles/desc_test_comments-trailing-on-next-line.proto (about)

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