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