This repository was archived by the owner on Sep 30, 2022. It is now read-only.
forked from TenderPro/rpc-sample-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.proto
More file actions
110 lines (92 loc) · 2.66 KB
/
main.proto
File metadata and controls
110 lines (92 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
syntax = "proto3";
//option go_package = "github.com/TenderPro/rpc-sample-app/proto";
package pb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "github.com/mwitkow/go-proto-validators/validator.proto";
import "github.com/nats-rpc/nrpc/nrpc.proto";
import "github.com/TenderPro/rpckit/app/ticker/ticker.proto";
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
//option (nrpc.packageSubject) = "root";
//option (nrpc.packageSubjectParams) = "instance";
//option (nrpc.serviceSubjectRule) = TOLOWER;
//option (nrpc.methodSubjectRule) = TOLOWER;
//option (gogoproto.gogoproto_import) = false;
import "protoc-gen-swagger/options/annotations.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
info: {
title: "gRPC-NATS Demo Service"
version: "1.0"
contact: {
name: "Aleksei Kovrizhkin"
url: "https://www.tender.pro"
email: "[email protected]"
};
};
schemes: [HTTP,HTTPS]
responses: {
key: "404"
value: {
description: "Returned when the resource does not exist."
schema: {
json_schema: {
type: STRING
};
};
};
};
};
service PingService {
rpc Ping(PingRequest) returns (PingResponse) {
option (google.api.http) = {
get: "/v1/sample/ping"
};
}
rpc PingEmpty(Empty) returns (PingResponse) {
option (google.api.http) = {
get: "/v1/sample/ping/empty"
};
}
rpc PingError(PingRequest) returns (Empty) {
option (google.api.http) = {
get: "/v1/sample/ping/error"
};
}
rpc PingList(PingRequest) returns (stream PingResponse) {
option (google.api.http) = {
get: "/v1/sample/ping/list/{value}"
};
option (nrpc.streamedReply) = true;
}
/*
SOAP does not support client streaming, so skip it
rpc PingStream(stream PingRequest) returns (stream PingResponse) {
option (google.api.http) = {
post: "/v1/sample/ping/stream"
body: "*"
};
option (nrpc.streamedReply) = true;
}
*/
// Время на сервере
rpc TimeService(ticker.TimeRequest) returns (stream ticker.TimeResponse) {
option (google.api.http) = {
get: "/v1/time/{every}"
};
option (nrpc.streamedReply) = true;
}
}
message Empty {
}
message PingRequest {
string value = 1 [(gogoproto.moretags) = "log_field:\"ping_value\""];
int32 sleep_time_ms = 2 [(validator.field) = {int_gt: 0, int_lt: 10}];
uint32 error_code_returned = 3;
}
message PingResponse {
string Value = 1;
int32 counter = 2;
}