2020-01-22 13:02:06 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package helloworld;
|
|
|
|
|
2023-07-07 23:33:10 +00:00
|
|
|
option go_package = "go.linka.cloud/grpc-toolkit/example;main";
|
2021-09-17 23:39:15 +00:00
|
|
|
|
|
|
|
import "google/api/annotations.proto";
|
2021-11-21 13:58:49 +00:00
|
|
|
import "validate/validate.proto";
|
2021-11-21 15:13:43 +00:00
|
|
|
import "defaults/defaults.proto";
|
2020-01-22 13:02:06 +00:00
|
|
|
|
|
|
|
service Greeter {
|
2021-09-17 23:39:15 +00:00
|
|
|
rpc SayHello (HelloRequest) returns (HelloReply) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v1/greeter/hello"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2020-01-22 13:02:06 +00:00
|
|
|
rpc SayHelloStream (HelloStreamRequest) returns (stream HelloReply) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
message HelloRequest {
|
2021-11-21 13:58:49 +00:00
|
|
|
string name = 1 [(validate.rules).string = {min_len: 2, max_len: 40}];
|
2020-01-22 13:02:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message HelloReply {
|
|
|
|
string message = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message HelloStreamRequest {
|
2021-11-21 13:58:49 +00:00
|
|
|
string name = 1 [(validate.rules).string = {min_len: 2, max_len: 40}];
|
2021-11-21 15:13:43 +00:00
|
|
|
int64 count = 2 [(validate.rules).int64 = {gte: 1, lte: 10}, (defaults.value).int64 = 10];
|
2020-01-22 13:02:06 +00:00
|
|
|
}
|