gr_hz/testdata/protobuf2/psm/psm.proto
2024-04-30 20:22:44 +08:00

155 lines
4.3 KiB
Protocol Buffer

syntax = "proto2";
package psm;
option go_package = "gr_hz/test/hertz_model/psm";
import "api.proto";
import "base.proto";
import "other/other.proto";
enum EnumType {
TWEET = 0;
RETWEET = 1;
}
message UnusedMessageType {
optional string IsUnusedMessageType = 1;
}
message BaseType {
optional base.Base IsBaseType = 1;
}
message MultiTypeReq {
// basic type (leading comments)
optional bool IsBoolOpt = 1;
required bool IsBoolReq = 2;
optional int32 IsInt32Opt = 3;
required int32 IsInt32Req = 4;
optional int64 IsInt64Opt = 5;
optional uint32 IsUInt32Opt = 6;
optional uint64 IsUInt64Opt = 7;
optional sint32 IsSInt32Opt = 8;
optional sint64 IsSInt64Opt = 9;
optional fixed32 IsFix32Opt = 10;
optional fixed64 IsFix64Opt = 11;
optional sfixed32 IsSFix32Opt = 12;
optional sfixed64 IsSFix64Opt = 13;
optional double IsDoubleOpt = 14;
required double IsDoubleReq = 15;
optional float IsFloatOpt = 16;
optional string IsStringOpt = 17;
required string IsStringReq = 18;
optional bytes IsBytesOpt = 19;
optional bytes IsBytesReq = 20;
// slice
repeated string IsRepeatedString = 21;
repeated BaseType IsRepeatedBaseType = 22;
// map
map<string, string> IsStringMap = 23;
map<string, BaseType> IsBaseTypeMap = 24;
// oneof
// multiple comments
oneof TestOneof {
string IsOneofString = 25;
BaseType IsOneofBaseType = 26;
int32 IsOneofInt = 100;
bool IsOneofBool = 101;
double IsOneoDouble = 102;
bytes IsOneofBytes = 103;
}
// this is oneof2, one field in oneof
oneof TestOneof2 {
string IsOneof2String = 104;
}
message NestedMessageType {
optional string IsNestedString = 1;
optional BaseType IsNestedBaseType = 2;
repeated BaseType IsNestedRepeatedBaseType = 3;
// nested oneof
oneof NestedMsgOneof {
string IsNestedMsgOneofString = 4;
EnumType IsNestedMsgOneofEnumType = 5;
}
}
// nested message
optional NestedMessageType IsNestedType = 27;
// other dependency
optional base.Base IsCurrentPackageBase = 28;
optional hertz.other.OtherType IsOtherType = 29;
// enum
optional EnumType IsEnumTypeOpt = 30;
required EnumType IsEnumTypeReq = 31;
repeated EnumType IsEnumTypeList = 32;
optional base.BaseEnumType IsBaseEnumType = 33;
}
message MultiTagReq {
optional string QueryTag = 1 [(api.query) = "query", (api.none) = "true"];
optional string RawBodyTag = 2 [(api.raw_body) = "raw_body"];
optional string CookieTag = 3 [(api.cookie) = "cookie"];
optional string BodyTag = 4 [(api.body) = "body"];
optional string PathTag = 5 [(api.path) = "path"];
optional string VdTag = 6 [(api.vd) = "$!='?'"];
optional string FormTag = 7 [(api.form) = "form"];
optional string DefaultTag = 8 [(api.go_tag) = "FFF:\"fff\" json:\"json\""];
}
message CompatibleAnnoReq {
optional string FormCompatibleTag = 1 [(api.form_compatible) = "form"];
optional string FilenameCompatibleTag = 2 [(api.file_name_compatible) = "file_name"];
optional string NoneCompatibleTag = 3 [(api.none_compatible) = "true"];
optional string JsConvCompatibleTag = 4 [(api.js_conv_compatible) = "true"];
}
message Resp {
optional string Resp = 1;
}
message MultiNameStyleMessage {
optional string hertz = 1;
optional string Hertz = 2;
optional string hertz_demo = 3;
optional string hertz_demo_idl = 4;
optional string hertz_Idl = 5;
optional string hertzDemo = 6;
optional string h = 7;
optional string H = 8;
optional string hertz_ = 9;
}
service Hertz {
rpc Method1(MultiTypeReq) returns(Resp) {
option (api.get) = "/company/department/group/user:id/name";
}
rpc Method2(MultiTypeReq) returns(Resp) {
option (api.post) = "/company/department/group/user:id/sex";
}
rpc Method3(MultiTypeReq) returns(Resp) {
option (api.put) = "/company/department/group/user:id/number";
}
rpc Method4(MultiTypeReq) returns(Resp) {
option (api.delete) = "/company/department/group/user:id/age";
}
rpc Method5(MultiTagReq) returns(Resp) {
option (api.options) = "/school/class/student/name";
}
rpc Method6(MultiTagReq) returns(Resp) {
option (api.head) = "/school/class/student/number";
}
rpc Method7(MultiTagReq) returns(Resp) {
option (api.patch) = "/school/class/student/sex";
}
rpc Method8(MultiTagReq) returns(Resp) {
option (api.any) = "/school/class/student/grade/*subjects";
}
}