blob: 1910e9bd2dee7dc241bb49a4bba3061419df8342 [file] [log] [blame]
Jan Tattermusch2d924952015-05-06 10:23:17 -07001/*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34#include <cctype>
35#include <map>
36#include <vector>
37
38#include "src/compiler/config.h"
Jan Tattermuschb5897bf2015-05-07 15:45:37 -070039#include "src/compiler/csharp_generator_helpers.h"
Jan Tattermusch2d924952015-05-06 10:23:17 -070040#include "src/compiler/csharp_generator.h"
41
42using grpc::protobuf::FileDescriptor;
43using grpc::protobuf::Descriptor;
44using grpc::protobuf::ServiceDescriptor;
45using grpc::protobuf::MethodDescriptor;
46using grpc::protobuf::io::Printer;
47using grpc::protobuf::io::StringOutputStream;
Jan Tattermuschb5897bf2015-05-07 15:45:37 -070048using grpc_generator::MethodType;
49using grpc_generator::GetMethodType;
50using grpc_generator::METHODTYPE_NO_STREAMING;
51using grpc_generator::METHODTYPE_CLIENT_STREAMING;
52using grpc_generator::METHODTYPE_SERVER_STREAMING;
53using grpc_generator::METHODTYPE_BIDI_STREAMING;
Jan Tattermusch41f9f332015-05-20 08:52:00 -070054using grpc_generator::StringReplace;
Jan Tattermusch2d924952015-05-06 10:23:17 -070055using std::map;
56using std::vector;
57
58namespace grpc_csharp_generator {
59namespace {
60
Jan Tattermusch41f9f332015-05-20 08:52:00 -070061// TODO(jtattermusch): make GetFileNamespace part of libprotoc public API.
62// NOTE: Implementation needs to match exactly to GetFileNamespace
63// defined in csharp_helpers.h in protoc csharp plugin.
64// We cannot reference it directly because google3 protobufs
65// don't have a csharp protoc plugin.
66std::string GetFileNamespace(const FileDescriptor* file) {
67 if (file->options().has_csharp_namespace()) {
68 return file->options().csharp_namespace();
69 }
Jan Tattermusch2d924952015-05-06 10:23:17 -070070 return file->package();
71}
72
Jan Tattermusch41f9f332015-05-20 08:52:00 -070073std::string ToCSharpName(const std::string& name, const FileDescriptor* file) {
74 std::string result = GetFileNamespace(file);
75 if (result != "") {
76 result += '.';
77 }
78 std::string classname;
79 if (file->package().empty()) {
80 classname = name;
81 } else {
82 // Strip the proto package from full_name since we've replaced it with
83 // the C# namespace.
84 classname = name.substr(file->package().size() + 1);
85 }
86 result += StringReplace(classname, ".", ".Types.", false);
87 return "global::" + result;
88}
89
90// TODO(jtattermusch): make GetClassName part of libprotoc public API.
91// NOTE: Implementation needs to match exactly to GetClassName
92// defined in csharp_helpers.h in protoc csharp plugin.
93// We cannot reference it directly because google3 protobufs
94// don't have a csharp protoc plugin.
95std::string GetClassName(const Descriptor* message) {
96 return ToCSharpName(message->full_name(), message->file());
Jan Tattermusch2d924952015-05-06 10:23:17 -070097}
98
99std::string GetServiceClassName(const ServiceDescriptor* service) {
100 return service->name();
101}
102
103std::string GetClientInterfaceName(const ServiceDescriptor* service) {
104 return "I" + service->name() + "Client";
105}
106
107std::string GetClientClassName(const ServiceDescriptor* service) {
108 return service->name() + "Client";
109}
110
111std::string GetServerInterfaceName(const ServiceDescriptor* service) {
112 return "I" + service->name();
113}
114
115std::string GetCSharpMethodType(MethodType method_type) {
116 switch (method_type) {
117 case METHODTYPE_NO_STREAMING:
118 return "MethodType.Unary";
119 case METHODTYPE_CLIENT_STREAMING:
120 return "MethodType.ClientStreaming";
121 case METHODTYPE_SERVER_STREAMING:
122 return "MethodType.ServerStreaming";
123 case METHODTYPE_BIDI_STREAMING:
124 return "MethodType.DuplexStreaming";
125 }
126 GOOGLE_LOG(FATAL)<< "Can't get here.";
127 return "";
128}
129
130std::string GetServiceNameFieldName() {
131 return "__ServiceName";
132}
133
134std::string GetMarshallerFieldName(const Descriptor *message) {
135 return "__Marshaller_" + message->name();
136}
137
138std::string GetMethodFieldName(const MethodDescriptor *method) {
139 return "__Method_" + method->name();
140}
141
142std::string GetMethodRequestParamMaybe(const MethodDescriptor *method) {
143 if (method->client_streaming()) {
144 return "";
145 }
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700146 return GetClassName(method->input_type()) + " request, ";
Jan Tattermusch2d924952015-05-06 10:23:17 -0700147}
148
149std::string GetMethodReturnTypeClient(const MethodDescriptor *method) {
150 switch (GetMethodType(method)) {
151 case METHODTYPE_NO_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700152 return "Task<" + GetClassName(method->output_type()) + ">";
Jan Tattermusch2d924952015-05-06 10:23:17 -0700153 case METHODTYPE_CLIENT_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700154 return "AsyncClientStreamingCall<" + GetClassName(method->input_type())
155 + ", " + GetClassName(method->output_type()) + ">";
Jan Tattermusch2d924952015-05-06 10:23:17 -0700156 case METHODTYPE_SERVER_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700157 return "AsyncServerStreamingCall<" + GetClassName(method->output_type())
Jan Tattermusch2d924952015-05-06 10:23:17 -0700158 + ">";
159 case METHODTYPE_BIDI_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700160 return "AsyncDuplexStreamingCall<" + GetClassName(method->input_type())
161 + ", " + GetClassName(method->output_type()) + ">";
Jan Tattermusch2d924952015-05-06 10:23:17 -0700162 }
163 GOOGLE_LOG(FATAL)<< "Can't get here.";
164 return "";
165}
166
167std::string GetMethodRequestParamServer(const MethodDescriptor *method) {
168 switch (GetMethodType(method)) {
169 case METHODTYPE_NO_STREAMING:
170 case METHODTYPE_SERVER_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700171 return GetClassName(method->input_type()) + " request";
Jan Tattermusch2d924952015-05-06 10:23:17 -0700172 case METHODTYPE_CLIENT_STREAMING:
173 case METHODTYPE_BIDI_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700174 return "IAsyncStreamReader<" + GetClassName(method->input_type())
Jan Tattermusch2d924952015-05-06 10:23:17 -0700175 + "> requestStream";
176 }
177 GOOGLE_LOG(FATAL)<< "Can't get here.";
178 return "";
179}
180
181std::string GetMethodReturnTypeServer(const MethodDescriptor *method) {
182 switch (GetMethodType(method)) {
183 case METHODTYPE_NO_STREAMING:
184 case METHODTYPE_CLIENT_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700185 return "Task<" + GetClassName(method->output_type()) + ">";
Jan Tattermusch2d924952015-05-06 10:23:17 -0700186 case METHODTYPE_SERVER_STREAMING:
187 case METHODTYPE_BIDI_STREAMING:
188 return "Task";
189 }
190 GOOGLE_LOG(FATAL)<< "Can't get here.";
191 return "";
192}
193
194std::string GetMethodResponseStreamMaybe(const MethodDescriptor *method) {
195 switch (GetMethodType(method)) {
196 case METHODTYPE_NO_STREAMING:
197 case METHODTYPE_CLIENT_STREAMING:
198 return "";
199 case METHODTYPE_SERVER_STREAMING:
200 case METHODTYPE_BIDI_STREAMING:
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700201 return ", IServerStreamWriter<" + GetClassName(method->output_type())
Jan Tattermusch2d924952015-05-06 10:23:17 -0700202 + "> responseStream";
203 }
204 GOOGLE_LOG(FATAL)<< "Can't get here.";
205 return "";
206}
207
208// Gets vector of all messages used as input or output types.
209std::vector<const Descriptor*> GetUsedMessages(
210 const ServiceDescriptor *service) {
211 std::set<const Descriptor*> descriptor_set;
212 std::vector<const Descriptor*> result; // vector is to maintain stable ordering
213 for (int i = 0; i < service->method_count(); i++) {
214 const MethodDescriptor *method = service->method(i);
215 if (descriptor_set.find(method->input_type()) == descriptor_set.end()) {
216 descriptor_set.insert(method->input_type());
217 result.push_back(method->input_type());
218 }
219 if (descriptor_set.find(method->output_type()) == descriptor_set.end()) {
220 descriptor_set.insert(method->output_type());
221 result.push_back(method->output_type());
222 }
223 }
224 return result;
225}
226
227void GenerateMarshallerFields(Printer* out, const ServiceDescriptor *service) {
228 std::vector<const Descriptor*> used_messages = GetUsedMessages(service);
229 for (size_t i = 0; i < used_messages.size(); i++) {
230 const Descriptor *message = used_messages[i];
231 out->Print(
232 "static readonly Marshaller<$type$> $fieldname$ = Marshallers.Create((arg) => arg.ToByteArray(), $type$.ParseFrom);\n",
233 "fieldname", GetMarshallerFieldName(message), "type",
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700234 GetClassName(message));
Jan Tattermusch2d924952015-05-06 10:23:17 -0700235 }
236 out->Print("\n");
237}
238
239void GenerateStaticMethodField(Printer* out, const MethodDescriptor *method) {
240 out->Print(
241 "static readonly Method<$request$, $response$> $fieldname$ = new Method<$request$, $response$>(\n",
242 "fieldname", GetMethodFieldName(method), "request",
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700243 GetClassName(method->input_type()), "response",
244 GetClassName(method->output_type()));
Jan Tattermusch2d924952015-05-06 10:23:17 -0700245 out->Indent();
246 out->Indent();
247 out->Print("$methodtype$,\n", "methodtype",
248 GetCSharpMethodType(GetMethodType(method)));
249 out->Print("\"$methodname$\",\n", "methodname", method->name());
250 out->Print("$requestmarshaller$,\n", "requestmarshaller",
251 GetMarshallerFieldName(method->input_type()));
252 out->Print("$responsemarshaller$);\n", "responsemarshaller",
253 GetMarshallerFieldName(method->output_type()));
254 out->Print("\n");
255 out->Outdent();
256 out->Outdent();
257}
258
259void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
Jan Tattermuschb5332812015-07-14 19:29:35 -0700260 out->Print("// client interface\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700261 out->Print("public interface $name$\n", "name",
262 GetClientInterfaceName(service));
263 out->Print("{\n");
264 out->Indent();
265 for (int i = 0; i < service->method_count(); i++) {
266 const MethodDescriptor *method = service->method(i);
267 MethodType method_type = GetMethodType(method);
268
269 if (method_type == METHODTYPE_NO_STREAMING) {
270 // unary calls have an extra synchronous stub method
271 out->Print(
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700272 "$response$ $methodname$($request$ request, Metadata headers = null, CancellationToken cancellationToken = default(CancellationToken));\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700273 "methodname", method->name(), "request",
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700274 GetClassName(method->input_type()), "response",
275 GetClassName(method->output_type()));
Jan Tattermusch2d924952015-05-06 10:23:17 -0700276 }
277
278 std::string method_name = method->name();
279 if (method_type == METHODTYPE_NO_STREAMING) {
280 method_name += "Async"; // prevent name clash with synchronous method.
281 }
282 out->Print(
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700283 "$returntype$ $methodname$($request_maybe$Metadata headers = null, CancellationToken cancellationToken = default(CancellationToken));\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700284 "methodname", method_name, "request_maybe",
285 GetMethodRequestParamMaybe(method), "returntype",
286 GetMethodReturnTypeClient(method));
287 }
288 out->Outdent();
289 out->Print("}\n");
290 out->Print("\n");
291}
292
293void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
294 out->Print("// server-side interface\n");
295 out->Print("public interface $name$\n", "name",
296 GetServerInterfaceName(service));
297 out->Print("{\n");
298 out->Indent();
299 for (int i = 0; i < service->method_count(); i++) {
300 const MethodDescriptor *method = service->method(i);
301 out->Print("$returntype$ $methodname$(ServerCallContext context, $request$$response_stream_maybe$);\n",
302 "methodname", method->name(), "returntype",
303 GetMethodReturnTypeServer(method), "request",
304 GetMethodRequestParamServer(method), "response_stream_maybe",
305 GetMethodResponseStreamMaybe(method));
306 }
307 out->Outdent();
308 out->Print("}\n");
309 out->Print("\n");
310}
311
312void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
313 out->Print("// client stub\n");
314 out->Print(
Jan Tattermuschb5332812015-07-14 19:29:35 -0700315 "public class $name$ : ClientBase, $interface$\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700316 "name", GetClientClassName(service), "interface",
317 GetClientInterfaceName(service));
318 out->Print("{\n");
319 out->Indent();
320
321 // constructors
322 out->Print(
Jan Tattermuschb5332812015-07-14 19:29:35 -0700323 "public $name$(Channel channel) : base(channel)\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700324 "name", GetClientClassName(service));
325 out->Print("{\n");
326 out->Print("}\n");
327
328 for (int i = 0; i < service->method_count(); i++) {
329 const MethodDescriptor *method = service->method(i);
330 MethodType method_type = GetMethodType(method);
331
332 if (method_type == METHODTYPE_NO_STREAMING) {
333 // unary calls have an extra synchronous stub method
334 out->Print(
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700335 "public $response$ $methodname$($request$ request, Metadata headers = null, CancellationToken cancellationToken = default(CancellationToken))\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700336 "methodname", method->name(), "request",
Jan Tattermusch41f9f332015-05-20 08:52:00 -0700337 GetClassName(method->input_type()), "response",
338 GetClassName(method->output_type()));
Jan Tattermusch2d924952015-05-06 10:23:17 -0700339 out->Print("{\n");
340 out->Indent();
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700341 out->Print("var call = CreateCall($servicenamefield$, $methodfield$, headers);\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700342 "servicenamefield", GetServiceNameFieldName(), "methodfield",
343 GetMethodFieldName(method));
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700344 out->Print("return Calls.BlockingUnaryCall(call, request, cancellationToken);\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700345 out->Outdent();
346 out->Print("}\n");
347 }
348
349 std::string method_name = method->name();
350 if (method_type == METHODTYPE_NO_STREAMING) {
351 method_name += "Async"; // prevent name clash with synchronous method.
352 }
353 out->Print(
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700354 "public $returntype$ $methodname$($request_maybe$Metadata headers = null, CancellationToken cancellationToken = default(CancellationToken))\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700355 "methodname", method_name, "request_maybe",
356 GetMethodRequestParamMaybe(method), "returntype",
357 GetMethodReturnTypeClient(method));
358 out->Print("{\n");
359 out->Indent();
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700360 out->Print("var call = CreateCall($servicenamefield$, $methodfield$, headers);\n",
Jan Tattermusch2d924952015-05-06 10:23:17 -0700361 "servicenamefield", GetServiceNameFieldName(), "methodfield",
362 GetMethodFieldName(method));
363 switch (GetMethodType(method)) {
364 case METHODTYPE_NO_STREAMING:
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700365 out->Print("return Calls.AsyncUnaryCall(call, request, cancellationToken);\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700366 break;
367 case METHODTYPE_CLIENT_STREAMING:
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700368 out->Print("return Calls.AsyncClientStreamingCall(call, cancellationToken);\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700369 break;
370 case METHODTYPE_SERVER_STREAMING:
371 out->Print(
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700372 "return Calls.AsyncServerStreamingCall(call, request, cancellationToken);\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700373 break;
374 case METHODTYPE_BIDI_STREAMING:
Jan Tattermuschfd953a52015-07-14 21:41:29 -0700375 out->Print("return Calls.AsyncDuplexStreamingCall(call, cancellationToken);\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700376 break;
377 default:
378 GOOGLE_LOG(FATAL)<< "Can't get here.";
379 }
380 out->Outdent();
381 out->Print("}\n");
382 }
383 out->Outdent();
384 out->Print("}\n");
385 out->Print("\n");
386}
387
388void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service) {
389 out->Print(
390 "// creates service definition that can be registered with a server\n");
391 out->Print(
392 "public static ServerServiceDefinition BindService($interface$ serviceImpl)\n",
393 "interface", GetServerInterfaceName(service));
394 out->Print("{\n");
395 out->Indent();
396
397 out->Print(
398 "return ServerServiceDefinition.CreateBuilder($servicenamefield$)\n",
399 "servicenamefield", GetServiceNameFieldName());
400 out->Indent();
401 out->Indent();
402 for (int i = 0; i < service->method_count(); i++) {
403 const MethodDescriptor *method = service->method(i);
404 out->Print(".AddMethod($methodfield$, serviceImpl.$methodname$)",
405 "methodfield", GetMethodFieldName(method), "methodname",
406 method->name());
407 if (i == service->method_count() - 1) {
408 out->Print(".Build();");
409 }
410 out->Print("\n");
411 }
412 out->Outdent();
413 out->Outdent();
414
415 out->Outdent();
416 out->Print("}\n");
417 out->Print("\n");
418}
419
420void GenerateNewStubMethods(Printer* out, const ServiceDescriptor *service) {
Jan Tattermuschb5332812015-07-14 19:29:35 -0700421 out->Print("// creates a new client\n");
422 out->Print("public static $classname$ NewClient(Channel channel)\n",
423 "classname", GetClientClassName(service));
Jan Tattermusch2d924952015-05-06 10:23:17 -0700424 out->Print("{\n");
425 out->Indent();
426 out->Print("return new $classname$(channel);\n", "classname",
427 GetClientClassName(service));
428 out->Outdent();
429 out->Print("}\n");
430 out->Print("\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700431}
432
433void GenerateService(Printer* out, const ServiceDescriptor *service) {
434 out->Print("public static class $classname$\n", "classname",
435 GetServiceClassName(service));
436 out->Print("{\n");
437 out->Indent();
438 out->Print("static readonly string $servicenamefield$ = \"$servicename$\";\n",
439 "servicenamefield", GetServiceNameFieldName(), "servicename",
440 service->full_name());
441 out->Print("\n");
442
443 GenerateMarshallerFields(out, service);
444 for (int i = 0; i < service->method_count(); i++) {
445 GenerateStaticMethodField(out, service->method(i));
446 }
447 GenerateClientInterface(out, service);
448 GenerateServerInterface(out, service);
449 GenerateClientStub(out, service);
450 GenerateBindServiceMethod(out, service);
451 GenerateNewStubMethods(out, service);
452
453 out->Outdent();
454 out->Print("}\n");
455}
456
457} // anonymous namespace
458
459grpc::string GetServices(const FileDescriptor *file) {
460 grpc::string output;
Jan Tattermusch5dcebd92015-05-27 15:30:59 -0700461 {
462 // Scope the output stream so it closes and finalizes output to the string.
Jan Tattermusch2d924952015-05-06 10:23:17 -0700463
Jan Tattermusch5dcebd92015-05-27 15:30:59 -0700464 StringOutputStream output_stream(&output);
465 Printer out(&output_stream, '$');
466
467 // Don't write out any output if there no services, to avoid empty service
468 // files being generated for proto files that don't declare any.
469 if (file->service_count() == 0) {
470 return output;
471 }
472
473 // Write out a file header.
474 out.Print("// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
475 out.Print("// source: $filename$\n", "filename", file->name());
476 out.Print("#region Designer generated code\n");
477 out.Print("\n");
478 out.Print("using System;\n");
479 out.Print("using System.Threading;\n");
480 out.Print("using System.Threading.Tasks;\n");
481 out.Print("using Grpc.Core;\n");
482 // TODO(jtattermusch): add using for protobuf message classes
483 out.Print("\n");
484
485 out.Print("namespace $namespace$ {\n", "namespace", GetFileNamespace(file));
486 out.Indent();
487 for (int i = 0; i < file->service_count(); i++) {
488 GenerateService(&out, file->service(i));
489 }
490 out.Outdent();
491 out.Print("}\n");
492 out.Print("#endregion\n");
Jan Tattermusch2d924952015-05-06 10:23:17 -0700493 }
Jan Tattermusch2d924952015-05-06 10:23:17 -0700494 return output;
495}
496
497} // namespace grpc_csharp_generator