[ 
https://issues.apache.org/jira/browse/CAMEL-13909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hari Rao updated CAMEL-13909:
-----------------------------
    Description: 
In the camel-swagger-rest-dsl-generator project, it is not generating .type & 
.outType rest dsl though available as part of openapi 2.0 (swagger) spec.

This is because in (as far as I investigated) in 
org.apache.camel.generator.swagger.OperationVisitor class we have the following 
code and beyond we do not have options to emit type & outType. Besides in the 
method, it is also not possible to pass User defined objects which will help to 
create those models.
{code:java}
void visit(final HttpMethod method, final Operation operation, final Swagger 
swagger) {
 if (filter.accept(operation.getOperationId())) {
 final String methodName = method.name().toLowerCase();
 emitter.emit(methodName, path);

 emit("id", operation.getOperationId());
 emit("description", operation.getDescription());
 emit("consumes", operation.getConsumes());
 emit("produces", operation.getProduces());{code}

  was:
In the camel-swagger-rest-dsl-generator project, it is not generating .type & 
.outType rest dsl though available as part of openapi 2.0 (swagger) spec.

This is because in (as far as I investigated) in 
org.apache.camel.generator.swagger.OperationVisitor class we have the following 
code and beyond we do not have options to emit type & outType. Besides in the 
method, it is also not possible to pass User defined objects which will help to 
create those models. 

```
{color:#cc7832}void {color}{color:#ffc66d}visit{color}({color:#cc7832}final 
{color}HttpMethod method{color:#cc7832}, final {color}Operation 
operation{color:#cc7832}, final {color}Swagger swagger) {
 {color:#cc7832}if 
{color}({color:#9876aa}filter{color}.accept(operation.getOperationId())) {
 {color:#cc7832}final {color}String methodName = 
method.name().toLowerCase(){color:#cc7832};
{color} {color:#9876aa}emitter{color}.emit(methodName{color:#cc7832}, 
{color}{color:#9876aa}path{color}){color:#cc7832};
{color}{color:#cc7832}
{color} emit({color:#668700}"id"{color}{color:#cc7832}, 
{color}operation.getOperationId()){color:#cc7832};
{color} emit({color:#668700}"description"{color}{color:#cc7832}, 
{color}operation.getDescription()){color:#cc7832};
{color} emit({color:#668700}"consumes"{color}{color:#cc7832}, 
{color}operation.getConsumes()){color:#cc7832};
{color} emit({color:#668700}"produces"{color}{color:#cc7832}, 
{color}operation.getProduces()){color:#cc7832};{color}
```


> Camel Rest-DSL doesn't generate type & outType from openapi 2.0 file
> --------------------------------------------------------------------
>
>                 Key: CAMEL-13909
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13909
>             Project: Camel
>          Issue Type: Bug
>          Components: rest, tooling
>            Reporter: Hari Rao
>            Priority: Major
>
> In the camel-swagger-rest-dsl-generator project, it is not generating .type & 
> .outType rest dsl though available as part of openapi 2.0 (swagger) spec.
> This is because in (as far as I investigated) in 
> org.apache.camel.generator.swagger.OperationVisitor class we have the 
> following code and beyond we do not have options to emit type & outType. 
> Besides in the method, it is also not possible to pass User defined objects 
> which will help to create those models.
> {code:java}
> void visit(final HttpMethod method, final Operation operation, final Swagger 
> swagger) {
>  if (filter.accept(operation.getOperationId())) {
>  final String methodName = method.name().toLowerCase();
>  emitter.emit(methodName, path);
>  emit("id", operation.getOperationId());
>  emit("description", operation.getDescription());
>  emit("consumes", operation.getConsumes());
>  emit("produces", operation.getProduces());{code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to