CodeGenerationRequest
Describes the services, dependencies and trivia from an IDL file, and the IDL itself through its specific serializer and deserializer.
struct CodeGenerationRequest
Describes the services, dependencies and trivia from an IDL file, and the IDL itself through its specific serializer and deserializer.
struct CodeGenerationRequest
import GRPCCodeGen
init(fileName: String, leadingTrivia: String, dependencies: [Dependency], services: [ServiceDescriptor], makeSerializerCodeSnippet: @escaping (_ messageType: String) -> String, makeDeserializerCodeSnippet: @escaping (_ messageType: String) -> String)
var dependencies: [Dependency]
The Swift imports that the generated file depends on. The gRPC specific imports aren’t required as they will be added by default in the generated file.
var fileName: String
The name of the source file containing the IDL, including the extension if applicable.
var leadingTrivia: String
Any comments at the top of the file such as documentation and copyright headers. They will be placed at the top of the generated file. They are already formatted, meaning they contain “///” and new lines.
var makeDeserializerCodeSnippet: (_ messageType: String) -> String
Closure that receives a message type as a String
and returns a code snippet to initialize a MessageDeserializer
for that type as a String
.
var makeSerializerCodeSnippet: (_ messageType: String) -> String
Closure that receives a message type as a String
and returns a code snippet to initialise a MessageSerializer
for that type as a String
.
var services: [ServiceDescriptor]
A description of each service to generate.
init(fileName: String, leadingTrivia: String, dependencies: [Dependency], services: [ServiceDescriptor], lookupSerializer: @escaping (String) -> String, lookupDeserializer: @escaping (String) -> String)
var lookupDeserializer: (_ messageType: String) -> String { get set }
var lookupSerializer: (_ messageType: String) -> String { get set }