[CodeGenLib] Translator for enums containing type aliases and static properties (#1733)
Motivation:
In the generated code we want to have:
- enums for each namespace containing enums for all their services
- enums for each service (inside the corresponding namespace enum) containing
enums for all their methods, an array of all corresponding MethodDescriptors and type aliases for streaming and non-streaming protocols
- enums for each method (inside the corresponding service enum) containing
type aliases for the input and output types and a method descriptor (GRPCCore)
Modifications:
- Created the Translator protocol defining the 'translate()' function.
- Implemented the IDLToStructuredSwiftTranslator struct which conforms to the Translator protocol and creates the StructuredSwiftRepresentation for a CodeGenerationRequest calling the Specialized translators' functions.
- Created the SpecializedTranslator protocol.
- Implemented the TypeAliasTranslator, the first of the 3 SpecializedTranslators that takes in a CodeGenerationRequest object and creates all the enums, type aliases and properties mentioned in the Motivation, in StructuredSwiftRepresentation format.
- Created CodeGenError.
- Wrote SnippetTests.
Result:
The generated code will contain useful type aliases for message types and
protocol names, organized in namespace, service and method specific enums.