github.com/jhump/protoreflect@v1.16.0/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/jhump/protoreflect/internal/testprotos";
    15  
    16  import public "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 [
    29      packed = true,
    30      json_name = "|foo|",
    31      (testprotos.ffubar) = "abc",
    32      (testprotos.ffubarb) = "xyz"
    33    ]; // field trailer #1...
    34  
    35    // lead mfubar
    36    option (testprotos.mfubar) = true; // trailing mfubar
    37  
    38    // some detached comments
    39  
    40    // some detached comments with unicode θΏ™δΈͺζ˜―ε€Ό
    41  
    42    // Another field comment
    43  
    44    // label comment
    45    optional string name = 2 [default = "fubar"];
    46  
    47    extensions 100 to 200;
    48  
    49    extensions 201 to 250 [
    50      (testprotos.exfubarb) = "\000\001\002\003\004\005\006\007",
    51      (testprotos.exfubar) = "splat!"
    52    ];
    53  
    54    reserved 10 to 20, 30 to 50;
    55  
    56    reserved "foo", "bar", "baz";
    57  
    58    // Group comment with emoji πŸ˜€ 😍 πŸ‘» ❀ πŸ’― πŸ’₯ 🐢 πŸ¦‚ πŸ₯‘ 🍻 🌍 πŸš• πŸͺ
    59    optional group Extras = 3 {
    60      // trailer for Extras
    61  
    62      // this is a custom option
    63      option (testprotos.mfubar) = false;
    64  
    65      optional double dbl = 1;
    66  
    67      optional float flt = 2;
    68  
    69      option no_standard_descriptor_accessor = false;
    70  
    71      // Leading comment...
    72      optional string str = 3; // Trailing comment...
    73    }
    74  
    75    enum MarioCharacters {
    76      // trailer for enum
    77  
    78      // allow_alias comments!
    79      option allow_alias = true;
    80  
    81      MARIO = 1 [
    82        (testprotos.evfubars) = -314,
    83        (testprotos.evfubar) = 278
    84      ];
    85  
    86      LUIGI = 2 [
    87        (testprotos.evfubaruf) = 100,
    88        (testprotos.evfubaru) = 200
    89      ];
    90  
    91      PEACH = 3;
    92  
    93      BOWSER = 4;
    94  
    95      option (testprotos.efubars) = -321;
    96  
    97      WARIO = 5;
    98  
    99      WALUIGI = 6;
   100  
   101      SHY_GUY = 7 [(testprotos.evfubarsf) = 10101];
   102  
   103      HEY_HO = 7;
   104  
   105      MAGIKOOPA = 8;
   106  
   107      KAMEK = 8;
   108  
   109      SNIFIT = -101;
   110  
   111      option (testprotos.efubar) = 123;
   112    }
   113  
   114    // can be this or that
   115    oneof abc {
   116      // trailer for oneof abc
   117  
   118      string this = 4;
   119  
   120      int32 that = 5;
   121    }
   122  
   123    // can be these or those
   124    oneof xyz {
   125      // whoops?
   126      option (testprotos.oofubar) = "whoops, this has invalid UTF8! \274\377";
   127  
   128      string these = 6;
   129  
   130      int32 those = 7;
   131    }
   132  
   133    // map field
   134    map<string, string> things = 8;
   135  }
   136  
   137  // And next we'll need some extensions...
   138  
   139  extend Request {
   140    // trailer for extend block
   141  
   142    // comment for guid1
   143    optional uint64 guid1 = 123;
   144  
   145    // ... and a comment for guid2
   146    optional uint64 guid2 = 124;
   147  }
   148  
   149  message AnEmptyMessage {
   150  }
   151  
   152  // Service comment
   153  service RpcService {
   154    // service trailer
   155    // that spans multiple lines
   156  
   157    // option that sets field
   158    option (testprotos.sfubar) = { id: 100, name: "bob" };
   159  
   160    option deprecated = false; // DEPRECATED!
   161  
   162    option (testprotos.sfubare) = VALUE;
   163  
   164    // Method comment
   165    rpc StreamingRpc ( stream Request ) returns ( Request ); // compact method trailer
   166  
   167    rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) {
   168      // trailer for method
   169  
   170      // this RPC is deprecated!
   171      option deprecated = true;
   172  
   173      option (testprotos.mtfubar) = 12.340000;
   174  
   175      option (testprotos.mtfubard) = 123.456000;
   176    }
   177  }