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