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