1syntax = "proto2";
2
3package test;
4
5import "google/protobuf/any.proto";
6import "google/protobuf/duration.proto";
7import "google/protobuf/empty.proto";
8import "google/protobuf/struct.proto";
9import "google/protobuf/timestamp.proto";
10import "google/protobuf/wrappers.proto";
11
12option go_package = "main";
13
14// A service that allows testing all kinds of permutations of message
15// and field types in the grpcui web form.
16
17service KitchenSink {
18    rpc Ping (google.protobuf.Empty) returns (google.protobuf.Empty);
19    rpc Exchange (TestMessage) returns (TestMessage);
20    rpc UploadMany (stream TestMessage) returns (TestMessage);
21    rpc DownloadMany (TestMessage) returns (stream TestMessage);
22    rpc DoManyThings (stream TestMessage) returns (stream TestMessage);
23
24    rpc SendTimestamp(google.protobuf.Timestamp) returns (google.protobuf.Empty);
25    rpc SendDuration(google.protobuf.Duration) returns (google.protobuf.Empty);
26    rpc SendAny(google.protobuf.Any) returns (google.protobuf.Empty);
27    rpc SendStruct(google.protobuf.Struct) returns (google.protobuf.Empty);
28    rpc SendValue(google.protobuf.Value) returns (google.protobuf.Empty);
29    rpc SendListValue(google.protobuf.ListValue) returns (google.protobuf.Empty);
30    rpc SendBytes(google.protobuf.BytesValue) returns (google.protobuf.Empty);
31    rpc SendString(google.protobuf.StringValue) returns (google.protobuf.Empty);
32    rpc SendBool(google.protobuf.BoolValue) returns (google.protobuf.Empty);
33    rpc SendDouble(google.protobuf.DoubleValue) returns (google.protobuf.Empty);
34    rpc SendFloat(google.protobuf.FloatValue) returns (google.protobuf.Empty);
35    rpc SendInt32(google.protobuf.Int32Value) returns (google.protobuf.Empty);
36    rpc SendInt64(google.protobuf.Int64Value) returns (google.protobuf.Empty);
37    rpc SendUInt32(google.protobuf.UInt32Value) returns (google.protobuf.Empty);
38    rpc SendUInt64(google.protobuf.UInt64Value) returns (google.protobuf.Empty);
39
40    rpc SendMultipleTimestamp(stream google.protobuf.Timestamp) returns (google.protobuf.Empty);
41    rpc SendMultipleDuration(stream google.protobuf.Duration) returns (google.protobuf.Empty);
42    rpc SendMultipleAny(stream google.protobuf.Any) returns (google.protobuf.Empty);
43    rpc SendMultipleStruct(stream google.protobuf.Struct) returns (google.protobuf.Empty);
44    rpc SendMultipleValue(stream google.protobuf.Value) returns (google.protobuf.Empty);
45    rpc SendMultipleListValue(stream google.protobuf.ListValue) returns (google.protobuf.Empty);
46    rpc SendMultipleBytes(stream google.protobuf.BytesValue) returns (google.protobuf.Empty);
47    rpc SendMultipleString(stream google.protobuf.StringValue) returns (google.protobuf.Empty);
48    rpc SendMultipleBool(stream google.protobuf.BoolValue) returns (google.protobuf.Empty);
49    rpc SendMultipleDouble(stream google.protobuf.DoubleValue) returns (google.protobuf.Empty);
50    rpc SendMultipleFloat(stream google.protobuf.FloatValue) returns (google.protobuf.Empty);
51    rpc SendMultipleInt32(stream google.protobuf.Int32Value) returns (google.protobuf.Empty);
52    rpc SendMultipleInt64(stream google.protobuf.Int64Value) returns (google.protobuf.Empty);
53    rpc SendMultipleUInt32(stream google.protobuf.UInt32Value) returns (google.protobuf.Empty);
54    rpc SendMultipleUInt64(stream google.protobuf.UInt64Value) returns (google.protobuf.Empty);
55}
56
57enum State {
58    INVALID = 0;
59    INITIAL = 1;
60    PENDING = 2;
61    RUNNING = 3;
62    PAUSED = 4;
63    AWAITING_INPUT = 5;
64    CANCELLING = 6;
65    COMPLETE = 7;
66    CANCELLED = 8;
67    FAILED = 9;
68}
69
70enum Void {
71    VOID = 0;
72}
73
74message Person {
75    required uint64 id = 1;
76    required string name = 2;
77    optional Address address = 3;
78    optional double xyz = 4 [default = 3.14159];
79    optional string title = 5 [default = "overseer"];
80    repeated string labels = 6;
81    optional bool is_real = 7 [default = true];
82    optional bytes opaque = 8 [default = "\01\02\03\04"];
83
84    oneof relative {
85        Person parent = 9;
86        Person sibling = 10;
87        Person child = 11;
88        Void none = 12;
89    }
90}
91
92message Address {
93    required string line1 = 1;
94    optional string line2 = 2;
95    required string city = 3;
96    required string state = 4;
97    required uint32 zip = 5;
98}
99
100message WellKnowns {
101    required google.protobuf.Timestamp now = 1;
102    optional google.protobuf.Timestamp past = 2;
103    repeated google.protobuf.Timestamp futures = 3;
104
105    required google.protobuf.Duration period = 4;
106    optional google.protobuf.Duration next_interval = 5;
107    repeated google.protobuf.Duration history_intervals = 6;
108
109    required google.protobuf.Any neat = 7;
110    optional google.protobuf.Any extra = 8;
111    repeated google.protobuf.Any extensions = 9;
112
113    required google.protobuf.Struct object = 10;
114    optional google.protobuf.Struct optional_object = 11;
115    repeated google.protobuf.Struct objects = 12;
116
117    required google.protobuf.Value value = 13;
118    optional google.protobuf.Value optional_value = 14;
119    repeated google.protobuf.Value values = 15;
120
121    required google.protobuf.ListValue list = 16;
122    optional google.protobuf.ListValue optional_list = 17;
123    repeated google.protobuf.ListValue lists = 18;
124
125    required google.protobuf.BytesValue bytes = 19;
126    optional google.protobuf.BytesValue optional_bytes = 20;
127    repeated google.protobuf.BytesValue list_o_bytes = 21;
128
129    required google.protobuf.StringValue string = 22;
130    optional google.protobuf.StringValue optional_string = 23;
131    repeated google.protobuf.StringValue list_o_strings = 24;
132
133    required google.protobuf.BoolValue bool = 25;
134    optional google.protobuf.BoolValue optional_bool = 26;
135    repeated google.protobuf.BoolValue list_o_bools = 27;
136
137    required google.protobuf.DoubleValue double = 28;
138    optional google.protobuf.DoubleValue optional_double = 29;
139    repeated google.protobuf.DoubleValue list_o_doubles = 30;
140
141    required google.protobuf.FloatValue float = 31;
142    optional google.protobuf.FloatValue optional_float = 32;
143    repeated google.protobuf.FloatValue list_o_floats = 33;
144
145    required google.protobuf.Int32Value small_int = 34;
146    optional google.protobuf.Int32Value optional_small_int = 35;
147    repeated google.protobuf.Int32Value list_o_small_ints = 36;
148
149    required google.protobuf.Int64Value big_int = 37;
150    optional google.protobuf.Int64Value optional_big_int = 38;
151    repeated google.protobuf.Int64Value list_o_big_ints = 39;
152
153    required google.protobuf.UInt32Value small_id = 40;
154    optional google.protobuf.UInt32Value optional_small_id = 41;
155    repeated google.protobuf.UInt32Value list_o_small_ids = 42;
156
157    required google.protobuf.UInt64Value big_id = 43;
158    optional google.protobuf.UInt64Value optional_big_id = 44;
159    repeated google.protobuf.UInt64Value list_o_big_ids = 45;
160}
161
162message NumbersNumbersNumbers {
163    optional int32 usually_1 = 1 [default = 1];
164    optional int32 some_num_1 = 2;
165    required int32 needed_num_1 = 3;
166
167    optional int64 usually_2 = 4 [default = 2];
168    optional int64 some_num_2 = 5;
169    required int64 needed_num_2 = 6;
170
171    optional uint32 usually_3 = 7 [default = 3];
172    optional uint32 some_num_3 = 8;
173    required uint32 needed_num_3 = 9;
174
175    optional uint64 usually_4 = 10 [default = 4];
176    optional uint64 some_num_4 = 11;
177    required uint64 needed_num_4 = 12;
178
179    optional sint32 usually_5 = 13 [default = 5];
180    optional sint32 some_num_5 = 14;
181    required sint32 needed_num_5 = 15;
182
183    optional sint64 usually_6 = 16 [default = 6];
184    optional sint64 some_num_6 = 17;
185    required sint64 needed_num_6 = 18;
186
187    optional fixed32 usually_7 = 19 [default = 7];
188    optional fixed32 some_num_7 = 20;
189    required fixed32 needed_num_7 = 21;
190
191    optional fixed64 usually_8 = 22 [default = 8];
192    optional fixed64 some_num_8 = 23;
193    required fixed64 needed_num_8 = 24;
194
195    optional sfixed32 usually_9 = 25 [default = 9];
196    optional sfixed32 some_num_9 = 26;
197    required sfixed32 needed_num_9 = 27;
198
199    optional sfixed64 usually_10 = 28 [default = 10];
200    optional sfixed64 some_num_10 = 29;
201    required sfixed64 needed_num_10 = 30;
202}
203
204message Arrays {
205    repeated string names = 1;
206    repeated bytes data = 2;
207    repeated Person relatives = 3;
208    repeated State other_states = 14;
209}
210
211message Maps {
212    map<string, Void> string_set = 1;
213    map<int32, Void> int32_set = 2;
214    map<int64, Void> int64_set = 3;
215    map<uint32, Void> uint32_set = 4;
216    map<uint64, Void> uint64_set = 5;
217    map<sint32, Void> sint32_set = 6;
218    map<sint64, Void> sint64_set = 7;
219    map<fixed32, google.protobuf.Empty> fixed32_set = 8;
220    map<fixed64, google.protobuf.Empty> fixed64_set = 9;
221    map<sfixed32, google.protobuf.Empty> sfixed32_set = 10;
222    map<sfixed64, google.protobuf.Empty> sfixed64_set = 11;
223
224    map<int32, Person> people_by_employee_num = 12;
225    map<int32, State> states = 13;
226
227    map<string, string> string_names = 14;
228    map<string, bytes> bytes_names = 15;
229    map<string, bool> bool_names = 16;
230    map<string, double> double_names = 17;
231    map<string, float> float_names = 18;
232}
233
234message TestMessage {
235    optional TestMessage recurse = 2;
236    repeated TestMessage repeated_recurse = 3;
237
238    required Person person = 4;
239    required State state = 5;
240
241    optional NumbersNumbersNumbers numbers = 6;
242
243    optional float usually_4242 = 7 [default = 4242];
244    optional float some_num_a = 8;
245    required float needed_num_a = 9;
246
247    optional double usually_9999 = 10 [default = 9999];
248    optional double some_num_b = 11;
249    required double needed_num_b = 12;
250
251    optional State next_state = 13 [default = PENDING];
252
253    optional bytes base64_stuff = 14;
254    required bytes opaque_id = 15;
255
256    optional WellKnowns wk = 16;
257    optional Arrays arrays = 17;
258    optional Maps maps = 18;
259
260    optional group Misc = 19 {
261        optional string foo = 1;
262        optional int32 bar = 2;
263    }
264}