github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/desc/protoprint/testfiles/desc_test_comments-sorted.proto (about)

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