Hari Krishnan Murthy created CAMEL-12862:
--------------------------------------------

             Summary: Unable to register two different entity types while 
configuring camel REST DSL
                 Key: CAMEL-12862
                 URL: https://issues.apache.org/jira/browse/CAMEL-12862
             Project: Camel
          Issue Type: Bug
            Reporter: Hari Krishnan Murthy


While configuring routes for POST/PUT using REST DSL, I have issues in 
mapping/registering two entity classes at the same time.
For eg:

rest("/xxx/yyy").description("REST service")
 .produces("application/json")
 
 //Get all Interactions
 .get().description("Get all 
interactions").outType(GetInteractionsResponse.class)
 .param().name("session_id").type(header).description("Session 
ID").dataType("string").endParam()
 .to("direct:getAllInteraction")

//Get specific Interaction
 .get("/\{id}").description("Get Interaction by Interaction 
ID").outType(GetInteractionResponse.class)
 .param().name("session_id").type(header).description("Session 
ID").dataType("string").endParam()
 .param().name("id").type(path).description("Interaction 
ID").dataType("integer").endParam()
 .to("direct:getInteractionById")
 
 //Update an interaction
 .put("/\{id}").description("Update an Interaction by Interaction 
ID").consumes("application/json").type(PutInteraction.class)
 .param().name("session_id").type(header).description("Session 
ID").dataType("string").endParam()
 .param().name("id").type(path).description("Interaction 
ID").dataType("integer").endParam()
 .param().name("body").type(body).description("Interaction to be 
posted").endParam()
 .to("direct:putInteraction")
 
 //Post a new interaction
 .post().description("Post an 
Interaction").consumes("application/json").type(PostInteraction.class)
 .param().name("session_id").type(header).description("Session 
ID").dataType("string").endParam()
 .param().name("body").type(body).description("Interaction to be 
posted").endParam()
 .to("direct:postInteraction");
 
Upon deploying and executing the above routes, either the POST or PUT 
entities(PostInteraction/PutInteraction) passed in the request body as JSON are 
received as null on the server side(Rest Service that am invoking). This 
depends on whichever is defined the last. If the POST API is defined as the 
last route, then put entity is null and vice versa. I have tried to validate 
this behaviour multiple times by switching the order of definition. Right now 
am circumventing this issue by creating a new common pojo and mapping it for 
both POST and PUT

Technology used:
spring-boot-starter-parent: 1.5.1-RELEASE
camel-spring-boot-starter: 2.18.0



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

Reply via email to