github.com/bakjos/protoreflect@v1.9.2/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/bakjos/protoreflect/internal/testprotos";
    16  
    17  import public "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    // can be these or those
   109    oneof xyz {
   110      string these = 6;
   111  
   112      int32 those = 7;
   113    }
   114  
   115    // map field
   116    map<string, string> things = 8;
   117  }
   118  
   119  extend Request {
   120    // comment for guid1
   121    optional uint64 guid1 = 123;
   122  
   123    // ... and a comment for guid2
   124    optional uint64 guid2 = 124;
   125  }
   126  
   127  message AnEmptyMessage {
   128  }
   129  
   130  // Service comment
   131  service RpcService {
   132    // option that sets field
   133    option (testprotos.sfubar) = { id:100 name:"bob"  };
   134  
   135    option deprecated = false;
   136    // DEPRECATED!
   137  
   138    option (testprotos.sfubare) = VALUE;
   139  
   140    // Method comment
   141    rpc StreamingRpc ( stream Request ) returns ( Request );
   142  
   143    rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) {
   144      option deprecated = true;
   145  
   146      option (testprotos.mtfubar) = 12.340000;
   147  
   148      option (testprotos.mtfubard) = 123.456000;
   149    }
   150  }