mirror of
https://github.com/protobufjs/protobuf.js.git
synced 2025-12-08 20:58:55 +00:00
129 lines
2.7 KiB
Protocol Buffer
129 lines
2.7 KiB
Protocol Buffer
/**
|
|
* File with alternate comment syntax.
|
|
* This file uses double slash and regular star-slash comment styles for doc
|
|
* strings.
|
|
*/
|
|
|
|
syntax = "proto3";
|
|
|
|
// Message with
|
|
// a
|
|
// multi-line comment.
|
|
message Test1 {
|
|
|
|
/**
|
|
* Field with a doc-block comment.
|
|
*/
|
|
string field1 = 1;
|
|
|
|
// Field with a single-line comment starting with two slashes.
|
|
uint32 field2 = 2;
|
|
|
|
/// Field with a single-line comment starting with three slashes.
|
|
bool field3 = 3;
|
|
|
|
/* Field with a single-line slash-star comment. */
|
|
bool field4 = 4;
|
|
|
|
bool field5 = 5; // Field with a trailing single-line two-slash comment.
|
|
|
|
bool field6 = 6; /// Field with a trailing single-line three-slash comment.
|
|
|
|
bool field7 = 7; /* Field with a trailing single-line slash-star comment. */
|
|
|
|
bool field8 = 8;
|
|
|
|
// Field with a
|
|
// multi-line comment.
|
|
bool field9 = 9;
|
|
|
|
/**
|
|
* Field with a
|
|
* multi-line doc-block comment.
|
|
*/
|
|
string field10 = 10;
|
|
|
|
// Field with both block comment
|
|
string field11 = 11; // and trailing comment.
|
|
string field12 = 12; // Trailing comment in last line should not be recognized as leading comment for this field.
|
|
}
|
|
|
|
/* Message
|
|
with
|
|
a multiline plain slash-star
|
|
comment.
|
|
*/
|
|
message Test2 {
|
|
}
|
|
|
|
/*
|
|
* Message
|
|
* with
|
|
* a
|
|
* comment and stars.
|
|
*/
|
|
enum Test3 {
|
|
|
|
/** Value with a comment. */
|
|
ONE = 1;
|
|
|
|
// Value with a single-line comment.
|
|
TWO = 2;
|
|
|
|
/// Value with a triple-slash comment.
|
|
THREE = 3; // ignored
|
|
|
|
FOUR = 4; /// Other value with a comment.
|
|
|
|
// Leading comment for value with both types of comments after field with trailing comment.
|
|
FIVE = 5; // Trailing comment for value with both types of comments after field with trailing comment.
|
|
}
|
|
|
|
// Single line comment,
|
|
/*
|
|
followed by a block comment, followed by a newline. (issue #1616)
|
|
*/
|
|
message Test4 {
|
|
}
|
|
|
|
// line comment with
|
|
// whitespace in front
|
|
message Test5 {
|
|
}
|
|
|
|
// Multiple
|
|
// different
|
|
// comments
|
|
/*
|
|
with strange whitespace
|
|
*/
|
|
message Test6 {
|
|
}
|
|
|
|
service ServiceTest {
|
|
// My method does things
|
|
rpc SingleLineMethod (MyRequest) returns (MyResponse);
|
|
|
|
// TwoLineMethodWithComment documentation
|
|
rpc TwoLineMethodWithComment (MyRequest)
|
|
returns (MyResponse);
|
|
|
|
// Very very long method
|
|
rpc
|
|
ThreeLine012345678901234567890123456712345671234567123456783927483923473892837489238749832432874983274983274983274(MyRequest)
|
|
returns (MyResponse);
|
|
|
|
// Random comment
|
|
|
|
rpc TwoLineMethodNoComment (MyRequest)
|
|
returns (MyResponse);
|
|
}
|
|
|
|
message MyRequest {
|
|
string path = 1;
|
|
}
|
|
|
|
message MyResponse {
|
|
int32 status = 2;
|
|
}
|