[ 
https://issues.apache.org/jira/browse/CAMEL-12943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16693238#comment-16693238
 ] 

ASF GitHub Bot commented on CAMEL-12943:
----------------------------------------

dmvolod commented on issue #2623: CAMEL-12943: Rest DSL generates invalid 
swagger operation Id
URL: https://github.com/apache/camel/pull/2623#issuecomment-440274714
 
 
   @mswiderski , @oscerd thanks, full rebuild fixed build issue
   @tdiesler I reverted all CAMEL-12908 related commits and test it again. The 
error stack was the same, as files secure-rest1-camel-context.xml and 
secure-rest3-camel-context.xml contains the separate verbs with same 
uri="/test". I think this need to be fixed in wildfly-camel.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Rest DSL generates invalid swagger operation Id
> -----------------------------------------------
>
>                 Key: CAMEL-12943
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12943
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-swagger
>            Reporter: Thomas Diesler
>            Assignee: Dmitry Volodin
>            Priority: Major
>             Fix For: 2.23.0
>
>
> With this code
>  
> {code:java}
>         rest("/customers").description("Customers REST service")
>             .get("/\{id}")
>                 .bindingMode(RestBindingMode.auto)
>                 .id("getCustomerById")
>                 .description("Retrieves a customer for the specified id")
>                 .outType(Customer.class)
>                 .route()
>                     .process(exchange -> {
>                         Customer customer = new Customer();
>                         customer.setId(exchange.getIn().getHeader("id", 
> Integer.class));
>                         customer.setFirstName("Kermit");
>                         customer.setLastName("The Frog");
>                         exchange.getOut().setBody(customer);
>                     })
>                 .endRest();
> {code}
>  
> we see a swagger definition generated like this
>  
> {code:java}
>  "paths" : {
>     "/customers/\{id}" : {
>       "get" : {
>         "tags" : [ "customers" ],
>         "summary" : "Retrieves a customer for the specified id",
>         "operationId" : "route2",
>         "parameters" : [ {
>           "name" : "id",
>           "in" : "path",
>           "required" : true,
>           "type" : "string"
>         } ],
>         "responses" : {
>           "200" : {
>             "description" : "Output type",
>             "schema" : {
>               "$ref" : "#/definitions/Customer",
>               "originalRef" : "Customer"
>             },
>             "responseSchema" : {
>               "$ref" : "#/definitions/Customer",
>               "originalRef" : "Customer"
>             }
>           }
>         }
>       }
>     }
>   },
> {code}
>  
> The operationId seems to be incorrect.
>  
> In our testsuite, which checks the latest Camel HEAD every Monday, we see ...
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: The specified operation with 
> ID: `getCustomerById` cannot be found in the Swagger specification loaded 
> from `http://localhost:8080/api/swagger`. Operations defined in the 
> specification are: route2
>     at 
> org.apache.camel.component.rest.swagger.RestSwaggerEndpoint.createProducer(RestSwaggerEndpoint.java:198)
>     at 
> org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:573)
>     ... 190 more
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to