Browse Source

[CodeGenLib] Change location of method descriptor array in generated code (#1789)

Motivation:

The method descriptor array should reside inside the Methods enum (which should be called Method).

Modifications:

- added the descriptor array as a member of the Methods enum
- chenged the Methods enum name to Method
- changed the tests accordingly

Result:

Better organized generated code.
Stefana-Ioana Dranca 2 years ago
parent
commit
bc9ea3c202
1 changed files with 12 additions and 12 deletions
  1. 12 12
      Tests/GRPCProtobufCodeGenTests/ProtobufCodeGeneratorTests.swift

+ 12 - 12
Tests/GRPCProtobufCodeGenTests/ProtobufCodeGeneratorTests.swift

@@ -58,7 +58,7 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
 
         internal enum Helloworld {
             internal enum Greeter {
-                internal enum Methods {
+                internal enum Method {
                     internal enum SayHello {
                         internal typealias Input = HelloRequest
                         internal typealias Output = HelloReply
@@ -67,10 +67,10 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
                             method: "SayHello"
                         )
                     }
+                    internal static let descriptors: [MethodDescriptor] = [
+                        Methods.SayHello.descriptor
+                    ]
                 }
-                internal static let methods: [MethodDescriptor] = [
-                    Methods.SayHello.descriptor
-                ]
                 internal typealias ClientProtocol = Helloworld_GreeterClientProtocol
                 internal typealias Client = Helloworld_GreeterClient
             }
@@ -162,7 +162,7 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
 
         public enum Helloworld {
           public enum Greeter {
-            public enum Methods {
+            public enum Method {
               public enum SayHello {
                 public typealias Input = HelloRequest
                 public typealias Output = HelloReply
@@ -171,10 +171,10 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
                   method: "SayHello"
                 )
               }
+              public static let descriptors: [MethodDescriptor] = [
+                Methods.SayHello.descriptor
+              ]
             }
-            public static let methods: [MethodDescriptor] = [
-              Methods.SayHello.descriptor
-            ]
             public typealias StreamingServiceProtocol = Helloworld_GreeterServiceStreamingProtocol
             public typealias ServiceProtocol = Helloworld_GreeterServiceProtocol
           }
@@ -249,7 +249,7 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
 
         package enum Helloworld {
           package enum Greeter {
-            package enum Methods {
+            package enum Method {
               package enum SayHello {
                 package typealias Input = HelloRequest
                 package typealias Output = HelloReply
@@ -258,10 +258,10 @@ final class ProtobufCodeGeneratorTests: XCTestCase {
                   method: "SayHello"
                 )
               }
+              package static let descriptors: [MethodDescriptor] = [
+                Methods.SayHello.descriptor
+              ]
             }
-            package static let methods: [MethodDescriptor] = [
-              Methods.SayHello.descriptor
-            ]
             package typealias StreamingServiceProtocol = Helloworld_GreeterServiceStreamingProtocol
             package typealias ServiceProtocol = Helloworld_GreeterServiceProtocol
             package typealias ClientProtocol = Helloworld_GreeterClientProtocol