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