[
https://issues.apache.org/jira/browse/CAMEL-11006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15942438#comment-15942438
]
ASF GitHub Bot commented on CAMEL-11006:
----------------------------------------
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 <[email protected]>
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.
----
> Auto generate REST DSL for Camel from Swagger2.0/OAI specification
> ------------------------------------------------------------------
>
> Key: CAMEL-11006
> URL: https://issues.apache.org/jira/browse/CAMEL-11006
> Project: Camel
> Issue Type: New Feature
> Components: tooling
> Reporter: Christian Posta
> Assignee: Zoran Regvart
> Fix For: Future
>
>
> Would be awesome if we can generate a stub server project that has all
> dependencies in the pom.xml and implement the OAI spec with Camel REST DSL +
> swagger documentation annotations.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)