Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
With this code
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();
we see a swagger definition generated like this
"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" } } } } } },
The operationId seems to be incorrect.
In our testsuite, which checks the latest Camel HEAD every Monday, we see ...
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
Attachments
Issue Links
- causes
-
CAMEL-13162 Unknown parameter issue on weaving from-with on a REST-DSL route
- Resolved
- is caused by
-
CAMEL-12908 Cannot start route using rest dsl due to a mysterious duplicate routeId
- Resolved
- links to