Browse Source

Add comments to generated code.

Tim Burks 9 years ago
parent
commit
f47d0a5871

+ 12 - 11
Examples/Echo/Swift/Generated/echo.client.pb.swift

@@ -47,16 +47,16 @@ public enum Echo_EchoClientError : Error {
   case invalidMessageReceived
   case error(c: CallResult)
 }
-//
 // Get (Unary)
-//
 public class Echo_EchoGetCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Get")
   }
 
+  /// Run the call. Blocks until the reply is received.
   fileprivate func run(request: Echo_EchoRequest,
                        metadata: Metadata) throws -> Echo_EchoResponse {
     let done = NSCondition()
@@ -84,12 +84,12 @@ public class Echo_EchoGetCall {
     }
   }
 }
-//
-// Expand (Server streaming)
-//
+
+// Expand (Server Streaming)
 public class Echo_EchoExpandCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Expand")
   }
@@ -132,12 +132,12 @@ public class Echo_EchoExpandCall {
     return returnMessage
   }
 }
-//
-// Collect (Client streaming)
-//
+
+// Collect (Client Streaming)
 public class Echo_EchoCollectCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Collect")
   }
@@ -207,12 +207,12 @@ public class Echo_EchoCollectCall {
   }
 
 }
-//
-// Update (Bidirectional streaming)
-//
+
+// Update (Bidirectional Streaming)
 public class Echo_EchoUpdateCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Update")
   }
@@ -282,6 +282,7 @@ public class Echo_EchoUpdateCall {
   }
 }
 
+
 // Call methods of this class to make API calls.
 public class Echo_EchoService {
   private var channel: Channel

+ 33 - 12
Examples/Echo/Swift/Generated/echo.server.pb.swift

@@ -46,22 +46,25 @@ public enum Echo_EchoServerError : Error {
   case endOfStream
 }
 
+/// To build a server, implement a class that conforms to this protocol.
 public protocol Echo_EchoProvider {
   func get(request : Echo_EchoRequest) throws -> Echo_EchoResponse
   func expand(request : Echo_EchoRequest, session : Echo_EchoExpandSession) throws
   func collect(session : Echo_EchoCollectSession) throws
   func update(session : Echo_EchoUpdateSession) throws
 }
-// unary
+// Get (Unary)
 public class Echo_EchoGetSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try handler.receiveMessage(initialMetadata:Metadata()) {(requestData) in
@@ -80,20 +83,24 @@ public class Echo_EchoGetSession {
     }
   }
 }
-// server streaming
+
+// Expand (Server Streaming)
 public class Echo_EchoExpandSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Send a message. Nonblocking.
   public func Send(_ response: Echo_EchoResponse) throws {
     try! handler.sendResponse(message:response.serializeProtobuf()) {}
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.receiveMessage(initialMetadata:Metadata()) {(requestData) in
@@ -115,16 +122,19 @@ public class Echo_EchoExpandSession {
     }
   }
 }
-// client streaming
+
+// Collect (Client Streaming)
 public class Echo_EchoCollectSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Receive a message. Blocks until a message is received or the client closes the connection.
   public func Receive() throws -> Echo_EchoRequest {
     let done = NSCondition()
     var requestMessage : Echo_EchoRequest?
@@ -145,13 +155,15 @@ public class Echo_EchoCollectSession {
     return requestMessage!
   }
 
+  /// Send a response and close the connection.
   public func SendAndClose(_ response: Echo_EchoResponse) throws {
-    try! self.handler.sendResponse(message:response.serializeProtobuf(),
-                                   statusCode: 0,
-                                   statusMessage: "OK",
-                                   trailingMetadata: Metadata())
+    try self.handler.sendResponse(message:response.serializeProtobuf(),
+                                  statusCode: 0,
+                                  statusMessage: "OK",
+                                  trailingMetadata: Metadata())
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.sendMetadata(initialMetadata:Metadata()) {
@@ -164,16 +176,19 @@ public class Echo_EchoCollectSession {
     }
   }
 }
-// fully streaming
+
+// Update (Bidirectional Streaming)
 public class Echo_EchoUpdateSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Receive a message. Blocks until a message is received or the client closes the connection.
   public func Receive() throws -> Echo_EchoRequest {
     let done = NSCondition()
     var requestMessage : Echo_EchoRequest?
@@ -194,10 +209,12 @@ public class Echo_EchoUpdateSession {
     return requestMessage!
   }
 
+  /// Send a message. Nonblocking.
   public func Send(_ response: Echo_EchoResponse) throws {
     try handler.sendResponse(message:response.serializeProtobuf()) {}
   }
 
+  /// Close a connection. Blocks until the connection is closed.
   public func Close() {
     let done = NSCondition()
     try! self.handler.sendStatus(statusCode: 0,
@@ -212,6 +229,7 @@ public class Echo_EchoUpdateSession {
     done.unlock()
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.sendMetadata(initialMetadata:Metadata()) {
@@ -224,14 +242,15 @@ public class Echo_EchoUpdateSession {
     }
   }
 }
-//
-// main server for generated service
-//
+
+
+/// Main server for generated service
 public class Echo_EchoServer {
   private var address: String
   private var server: gRPC.Server
   public var provider: Echo_EchoProvider?
 
+  /// Create a server that accepts insecure connections.
   public init(address:String,
               provider:Echo_EchoProvider) {
     gRPC.initialize()
@@ -240,6 +259,7 @@ public class Echo_EchoServer {
     self.server = gRPC.Server(address:address)
   }
 
+  /// Create a server that accepts secure connections.
   public init?(address:String,
                certificateURL:URL,
                keyURL:URL,
@@ -256,6 +276,7 @@ public class Echo_EchoServer {
     self.server = gRPC.Server(address:address, key:key, certs:certificate)
   }
 
+  /// Start the server.
   public func start(queue:DispatchQueue = DispatchQueue.global()) {
     guard let provider = self.provider else {
       assert(false) // the server requires a provider
@@ -279,4 +300,4 @@ public class Echo_EchoServer {
       }
     }
   }
-}
+}

+ 2 - 0
Plugin/Sources/main.swift

@@ -212,6 +212,8 @@ func main() throws {
     }
   }
 
+  log += "\(request)"
+  
   // add the logfile to the code generation response
   var logfile = Google_Protobuf_Compiler_CodeGeneratorResponse.File()
   logfile.name = "swiftgrpc.log"

+ 10 - 0
Plugin/echo.proto

@@ -13,19 +13,29 @@
 // limitations under the License.
 
 syntax = "proto3";
+
 package echo;
 
 service Echo {
+  // Immediately returns an echo of a request.
   rpc Get(EchoRequest) returns (EchoResponse) {}
+  
+  // Splits a request into words and returns each word in a stream of messages.
   rpc Expand(EchoRequest) returns (stream EchoResponse) {}  
+  
+  // Collects a stream of messages and returns them concatenated when the caller closes.
   rpc Collect(stream EchoRequest) returns (EchoResponse) {}
+  
+  // Streams back messages as they are received in an input stream.
   rpc Update(stream EchoRequest) returns (stream EchoResponse) {}
 }
 
 message EchoRequest {
+  // The text of a message to be echoed.
   string text = 1;
 }
 
 message EchoResponse {
+  // The text of an echo response.
   string text = 1;
 }

+ 3 - 4
Plugin/templates/client-call-bidistreaming.swift

@@ -1,9 +1,8 @@
-//
-// {{ method.name }} (Bidirectional streaming)
-//
+// {{ method.name }} (Bidirectional Streaming)
 public class {{ .|call:protoFile,service,method }} {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
@@ -71,4 +70,4 @@ public class {{ .|call:protoFile,service,method }} {
     done.wait()
     done.unlock()
   }
-}
+}

+ 3 - 4
Plugin/templates/client-call-clientstreaming.swift

@@ -1,9 +1,8 @@
-//
-// {{ method.name }} (Client streaming)
-//
+// {{ method.name }} (Client Streaming)
 public class {{ .|call:protoFile,service,method }} {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
@@ -72,4 +71,4 @@ public class {{ .|call:protoFile,service,method }} {
       }
   }
 
-}
+}

+ 3 - 4
Plugin/templates/client-call-serverstreaming.swift

@@ -1,9 +1,8 @@
-//
-// {{ method.name }} (Server streaming)
-//
+// {{ method.name }} (Server Streaming)
 public class {{ .|call:protoFile,service,method }} {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
@@ -45,4 +44,4 @@ public class {{ .|call:protoFile,service,method }} {
     }
     return returnMessage
   }
-}
+}

+ 3 - 3
Plugin/templates/client-call-unary.swift

@@ -1,13 +1,13 @@
-//
 // {{ method.name }} (Unary)
-//
 public class {{ .|call:protoFile,service,method }} {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("{{ .|path:protoFile,service,method }}")
   }
 
+  /// Run the call. Blocks until the reply is received.
   fileprivate func run(request: {{ method|input }},
                        metadata: Metadata) throws -> {{ method|output }} {
     let done = NSCondition()
@@ -34,4 +34,4 @@ public class {{ .|call:protoFile,service,method }} {
       throw {{ .|clienterror:protoFile,service }}.error(c: callResult)
     }
   }
-}
+}

+ 7 - 2
Plugin/templates/server-session-bidistreaming.swift

@@ -1,13 +1,15 @@
-// fully streaming
+// {{ method.name }} (Bidirectional Streaming)
 public class {{ .|session:protoFile,service,method }} {
   var handler : gRPC.Handler
   var provider : {{ .|provider:protoFile,service }}
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: {{ .|provider:protoFile,service }}) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Receive a message. Blocks until a message is received or the client closes the connection.
   public func Receive() throws -> {{ method|input }} {
     let done = NSCondition()
     var requestMessage : {{ method|input }}?
@@ -28,10 +30,12 @@ public class {{ .|session:protoFile,service,method }} {
     return requestMessage!
   }
 
+  /// Send a message. Nonblocking.
   public func Send(_ response: {{ method|output }}) throws {
     try handler.sendResponse(message:response.serializeProtobuf()) {}
   }
 
+  /// Close a connection. Blocks until the connection is closed.
   public func Close() {
     let done = NSCondition()
     try! self.handler.sendStatus(statusCode: 0,
@@ -46,6 +50,7 @@ public class {{ .|session:protoFile,service,method }} {
     done.unlock()
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.sendMetadata(initialMetadata:Metadata()) {
@@ -57,4 +62,4 @@ public class {{ .|session:protoFile,service,method }} {
       print("grpc error: \(callError)")
     }
   }
-}
+}

+ 10 - 6
Plugin/templates/server-session-clientstreaming.swift

@@ -1,13 +1,15 @@
-// client streaming
+// {{ method.name }} (Client Streaming)
 public class {{ .|session:protoFile,service,method }} {
   var handler : gRPC.Handler
   var provider : {{ .|provider:protoFile,service }}
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: {{ .|provider:protoFile,service }}) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Receive a message. Blocks until a message is received or the client closes the connection.
   public func Receive() throws -> {{ method|input }} {
     let done = NSCondition()
     var requestMessage : {{ method|input }}?
@@ -28,13 +30,15 @@ public class {{ .|session:protoFile,service,method }} {
     return requestMessage!
   }
 
+  /// Send a response and close the connection.
   public func SendAndClose(_ response: {{ method|output }}) throws {
-    try! self.handler.sendResponse(message:response.serializeProtobuf(),
-                                   statusCode: 0,
-                                   statusMessage: "OK",
-                                   trailingMetadata: Metadata())
+    try self.handler.sendResponse(message:response.serializeProtobuf(),
+                                  statusCode: 0,
+                                  statusMessage: "OK",
+                                  trailingMetadata: Metadata())
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.sendMetadata(initialMetadata:Metadata()) {
@@ -46,4 +50,4 @@ public class {{ .|session:protoFile,service,method }} {
       print("grpc error: \(callError)")
     }
   }
-}
+}

+ 5 - 2
Plugin/templates/server-session-serverstreaming.swift

@@ -1,17 +1,20 @@
-// server streaming
+// {{ method.name }} (Server Streaming)
 public class {{ .|session:protoFile,service,method }} {
   var handler : gRPC.Handler
   var provider : {{ .|provider:protoFile,service }}
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: {{ .|provider:protoFile,service }}) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Send a message. Nonblocking.
   public func Send(_ response: {{ method|output }}) throws {
     try! handler.sendResponse(message:response.serializeProtobuf()) {}
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.receiveMessage(initialMetadata:Metadata()) {(requestData) in
@@ -32,4 +35,4 @@ public class {{ .|session:protoFile,service,method }} {
       print("grpc error: \(callError)")
     }
   }
-}
+}

+ 4 - 2
Plugin/templates/server-session-unary.swift

@@ -1,13 +1,15 @@
-// unary
+// {{ method.name }} (Unary)
 public class {{ .|session:protoFile,service,method }} {
   var handler : gRPC.Handler
   var provider : {{ .|provider:protoFile,service }}
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: {{ .|provider:protoFile,service }}) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try handler.receiveMessage(initialMetadata:Metadata()) {(requestData) in
@@ -25,4 +27,4 @@ public class {{ .|session:protoFile,service,method }} {
       print("grpc error: \(callError)")
     }
   }
-}
+}

+ 7 - 4
Plugin/templates/server.pb.swift

@@ -47,6 +47,7 @@ public enum {{ .|servererror:protoFile,service }} : Error {
   case endOfStream
 }
 
+/// To build a server, implement a class that conforms to this protocol.
 public protocol {{ .|provider:protoFile,service }} {
   //-{% for method in service.method %}
   //-{% if not method.clientStreaming and not method.serverStreaming %}
@@ -77,14 +78,14 @@ public protocol {{ .|provider:protoFile,service }} {
 //-{% include "server-session-bidistreaming.swift" %}
 //-{% endif %}
 //-{% endfor %}
-//
-// main server for generated service
-//
+
+/// Main server for generated service
 public class {{ .|server:protoFile,service }} {
   private var address: String
   private var server: gRPC.Server
   public var provider: {{ .|provider:protoFile,service }}?
 
+  /// Create a server that accepts insecure connections.
   public init(address:String,
               provider:{{ .|provider:protoFile,service }}) {
     gRPC.initialize()
@@ -93,6 +94,7 @@ public class {{ .|server:protoFile,service }} {
     self.server = gRPC.Server(address:address)
   }
 
+  /// Create a server that accepts secure connections.
   public init?(address:String,
                certificateURL:URL,
                keyURL:URL,
@@ -109,6 +111,7 @@ public class {{ .|server:protoFile,service }} {
     self.server = gRPC.Server(address:address, key:key, certs:certificate)
   }
 
+  /// Start the server.
   public func start(queue:DispatchQueue = DispatchQueue.global()) {
     guard let provider = self.provider else {
       assert(false) // the server requires a provider
@@ -129,4 +132,4 @@ public class {{ .|server:protoFile,service }} {
     }
   }
 }
-//-{% endfor %}
+//-{% endfor %}

+ 12 - 11
Samples/Echo/Sources/echo.client.pb.swift

@@ -47,16 +47,16 @@ public enum Echo_EchoClientError : Error {
   case invalidMessageReceived
   case error(c: CallResult)
 }
-//
 // Get (Unary)
-//
 public class Echo_EchoGetCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Get")
   }
 
+  /// Run the call. Blocks until the reply is received.
   fileprivate func run(request: Echo_EchoRequest,
                        metadata: Metadata) throws -> Echo_EchoResponse {
     let done = NSCondition()
@@ -84,12 +84,12 @@ public class Echo_EchoGetCall {
     }
   }
 }
-//
-// Expand (Server streaming)
-//
+
+// Expand (Server Streaming)
 public class Echo_EchoExpandCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Expand")
   }
@@ -132,12 +132,12 @@ public class Echo_EchoExpandCall {
     return returnMessage
   }
 }
-//
-// Collect (Client streaming)
-//
+
+// Collect (Client Streaming)
 public class Echo_EchoCollectCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Collect")
   }
@@ -207,12 +207,12 @@ public class Echo_EchoCollectCall {
   }
 
 }
-//
-// Update (Bidirectional streaming)
-//
+
+// Update (Bidirectional Streaming)
 public class Echo_EchoUpdateCall {
   var call : Call
 
+  /// Create a call.
   fileprivate init(_ channel: Channel) {
     self.call = channel.makeCall("/echo.Echo/Update")
   }
@@ -282,6 +282,7 @@ public class Echo_EchoUpdateCall {
   }
 }
 
+
 // Call methods of this class to make API calls.
 public class Echo_EchoService {
   private var channel: Channel

+ 33 - 12
Samples/Echo/Sources/echo.server.pb.swift

@@ -46,22 +46,25 @@ public enum Echo_EchoServerError : Error {
   case endOfStream
 }
 
+/// To build a server, implement a class that conforms to this protocol.
 public protocol Echo_EchoProvider {
   func get(request : Echo_EchoRequest) throws -> Echo_EchoResponse
   func expand(request : Echo_EchoRequest, session : Echo_EchoExpandSession) throws
   func collect(session : Echo_EchoCollectSession) throws
   func update(session : Echo_EchoUpdateSession) throws
 }
-// unary
+// Get (Unary)
 public class Echo_EchoGetSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try handler.receiveMessage(initialMetadata:Metadata()) {(requestData) in
@@ -80,20 +83,24 @@ public class Echo_EchoGetSession {
     }
   }
 }
-// server streaming
+
+// Expand (Server Streaming)
 public class Echo_EchoExpandSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Send a message. Nonblocking.
   public func Send(_ response: Echo_EchoResponse) throws {
     try! handler.sendResponse(message:response.serializeProtobuf()) {}
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.receiveMessage(initialMetadata:Metadata()) {(requestData) in
@@ -115,16 +122,19 @@ public class Echo_EchoExpandSession {
     }
   }
 }
-// client streaming
+
+// Collect (Client Streaming)
 public class Echo_EchoCollectSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Receive a message. Blocks until a message is received or the client closes the connection.
   public func Receive() throws -> Echo_EchoRequest {
     let done = NSCondition()
     var requestMessage : Echo_EchoRequest?
@@ -145,13 +155,15 @@ public class Echo_EchoCollectSession {
     return requestMessage!
   }
 
+  /// Send a response and close the connection.
   public func SendAndClose(_ response: Echo_EchoResponse) throws {
-    try! self.handler.sendResponse(message:response.serializeProtobuf(),
-                                   statusCode: 0,
-                                   statusMessage: "OK",
-                                   trailingMetadata: Metadata())
+    try self.handler.sendResponse(message:response.serializeProtobuf(),
+                                  statusCode: 0,
+                                  statusMessage: "OK",
+                                  trailingMetadata: Metadata())
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.sendMetadata(initialMetadata:Metadata()) {
@@ -164,16 +176,19 @@ public class Echo_EchoCollectSession {
     }
   }
 }
-// fully streaming
+
+// Update (Bidirectional Streaming)
 public class Echo_EchoUpdateSession {
   var handler : gRPC.Handler
   var provider : Echo_EchoProvider
 
+  /// Create a session.
   fileprivate init(handler:gRPC.Handler, provider: Echo_EchoProvider) {
     self.handler = handler
     self.provider = provider
   }
 
+  /// Receive a message. Blocks until a message is received or the client closes the connection.
   public func Receive() throws -> Echo_EchoRequest {
     let done = NSCondition()
     var requestMessage : Echo_EchoRequest?
@@ -194,10 +209,12 @@ public class Echo_EchoUpdateSession {
     return requestMessage!
   }
 
+  /// Send a message. Nonblocking.
   public func Send(_ response: Echo_EchoResponse) throws {
     try handler.sendResponse(message:response.serializeProtobuf()) {}
   }
 
+  /// Close a connection. Blocks until the connection is closed.
   public func Close() {
     let done = NSCondition()
     try! self.handler.sendStatus(statusCode: 0,
@@ -212,6 +229,7 @@ public class Echo_EchoUpdateSession {
     done.unlock()
   }
 
+  /// Run the session. Internal.
   fileprivate func run(queue:DispatchQueue) {
     do {
       try self.handler.sendMetadata(initialMetadata:Metadata()) {
@@ -224,14 +242,15 @@ public class Echo_EchoUpdateSession {
     }
   }
 }
-//
-// main server for generated service
-//
+
+
+/// Main server for generated service
 public class Echo_EchoServer {
   private var address: String
   private var server: gRPC.Server
   public var provider: Echo_EchoProvider?
 
+  /// Create a server that accepts insecure connections.
   public init(address:String,
               provider:Echo_EchoProvider) {
     gRPC.initialize()
@@ -240,6 +259,7 @@ public class Echo_EchoServer {
     self.server = gRPC.Server(address:address)
   }
 
+  /// Create a server that accepts secure connections.
   public init?(address:String,
                certificateURL:URL,
                keyURL:URL,
@@ -256,6 +276,7 @@ public class Echo_EchoServer {
     self.server = gRPC.Server(address:address, key:key, certs:certificate)
   }
 
+  /// Start the server.
   public func start(queue:DispatchQueue = DispatchQueue.global()) {
     guard let provider = self.provider else {
       assert(false) // the server requires a provider
@@ -279,4 +300,4 @@ public class Echo_EchoServer {
       }
     }
   }
-}
+}