GitHub user zregvart opened a pull request: https://github.com/apache/camel/pull/1574
CAMEL-11006 Auto generate REST DSL for Camel from Swagger2.0/OAI specification Submitting for review, thanks :1st_place_medal: This is initial work on REST DSL code|object generation from Swagger specification. Entry point to the implementation is RestDslGenerator::generate(...) 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. You can merge this pull request into a Git repository by running: $ git pull https://github.com/zregvart/camel CAMEL-11006 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/1574.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1574 ---- commit 627626089a0d55f5b7feb23df357c0f29490bf54 Author: Zoran Regvart <zregv...@apache.org> Date: 2017-03-26T09:32:16Z 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::generate(...) 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. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---