Browse Source

Add more comments to generated code.

Tim Burks 9 years ago
parent
commit
cbf2ea3a9c

+ 7 - 0
Examples/Echo/Swift/Generated/echo.client.pb.swift

@@ -42,6 +42,7 @@
 import Foundation
 import gRPC
 
+/// Type for errors thrown from generated client code.
 public enum Echo_EchoClientError : Error {
   case endOfStream
   case invalidMessageReceived
@@ -287,8 +288,12 @@ public class Echo_EchoUpdateCall {
 public class Echo_EchoService {
   private var channel: Channel
 
+  /// This metadata will be sent with all requests.
   public var metadata : Metadata
 
+  /// This property allows the service host name to be overridden.
+  /// For example, it can be used to make calls to "localhost:8080" 
+  /// appear to be to "example.com".
   public var host : String {
     get {
       return self.channel.host
@@ -298,12 +303,14 @@ public class Echo_EchoService {
     }
   }
 
+  /// Create a client that makes insecure connections.
   public init(address: String) {
     gRPC.initialize()
     channel = Channel(address:address)
     metadata = Metadata()
   }
 
+  /// Create a client that makes secure connections.
   public init(address: String, certificates: String?, host: String?) {
     gRPC.initialize()
     channel = Channel(address:address, certificates:certificates, host:host)

+ 1 - 0
Examples/Echo/Swift/Generated/echo.server.pb.swift

@@ -42,6 +42,7 @@
 import Foundation
 import gRPC
 
+/// Type for errors thrown from generated server code.
 public enum Echo_EchoServerError : Error {
   case endOfStream
 }

+ 7 - 0
Plugin/templates/client.pb.swift

@@ -43,6 +43,7 @@ import Foundation
 import gRPC
 //-{% for service in protoFile.service %}
 
+/// Type for errors thrown from generated client code.
 public enum {{ .|clienterror:protoFile,service }} : Error {
   case endOfStream
   case invalidMessageReceived
@@ -67,8 +68,12 @@ public enum {{ .|clienterror:protoFile,service }} : Error {
 public class {{ protoFile.package|capitalize }}_{{ service.name }}Service {
   private var channel: Channel
 
+  /// This metadata will be sent with all requests.
   public var metadata : Metadata
 
+  /// This property allows the service host name to be overridden.
+  /// For example, it can be used to make calls to "localhost:8080" 
+  /// appear to be to "example.com".
   public var host : String {
     get {
       return self.channel.host
@@ -78,12 +83,14 @@ public class {{ protoFile.package|capitalize }}_{{ service.name }}Service {
     }
   }
 
+  /// Create a client that makes insecure connections.
   public init(address: String) {
     gRPC.initialize()
     channel = Channel(address:address)
     metadata = Metadata()
   }
 
+  /// Create a client that makes secure connections.
   public init(address: String, certificates: String?, host: String?) {
     gRPC.initialize()
     channel = Channel(address:address, certificates:certificates, host:host)

+ 3 - 2
Plugin/templates/server.pb.swift

@@ -43,6 +43,7 @@ import Foundation
 import gRPC
 //-{% for service in protoFile.service %}
 
+/// Type for errors thrown from generated server code.
 public enum {{ .|servererror:protoFile,service }} : Error {
   case endOfStream
 }
@@ -123,10 +124,10 @@ public class {{ .|server:protoFile,service }} {
 
       do {
         switch handler.method {
-	  //-{% for method in service.method %}
+        //-{% for method in service.method %}
         case "{{ .|path:protoFile,service,method }}":
           try {{ .|session:protoFile,service,method }}(handler:handler, provider:provider).run(queue:queue)
-	  //-{% endfor %}
+        //-{% endfor %}
         default:
           break // handle unknown requests
         }