CAMEL-11006 Auto generate REST DSL for Camel fr... ...om Swagger2.0/OAI specification
This is initial work on REST DSL code|object generation from Swagger specification.
Entry point to the implementation is RestDslGenerator::to...(...) methods. Several options are provided for generating source files: - for code generation in Maven plugin ones accepting Path or Appendable should be suitable - for generation in Annotation Processing ones accepting Filer are more appropriate - and for generation of the object graph in runtime the one accepting CamelContext is provided
Both the source code and object graph implementation depend on a CodeEmitter implementation: one relying on reflection (RestDefinitionEmitter) is used to generate the object graph, and the one generating the source code for the RouteBuilder::configure method body using the javapoet library (MethodBodySourceCodeEmitter).
CodeEmitter is driven by two visitor pattern implementations one for processing path elements of the specification (RestDslPathGenerator) and one for processing operation elements of he specification (RestDslOperationGenerator). Both can be further adapted to support more of the Swagger specification. I believe they map the currently used / relevant parts of the Swagger specification covered by REST DSL.