[ https://issues.apache.org/jira/browse/CAMEL-8720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-8720: ------------------------------- Description: It would be nice if I could select a custom data format for an individual REST DSL route to marshal objects differently. For example: Say I have a REST service that returns company data including the company's employees. But when I get an individual employee, I want to include the URI of the company in the response. So I defined a "json-standalone" data format that uses a different Jackson view. {code} rest("/companies/{companyId}") .get() rest("/employees/{employeeId}") .get() .dataFormat("json-standalone") @Bean(name = "json-standalone") @Scope("prototype") public JacksonDataFormat dataFormat() { return new JacksonDataFormat(objectMapper, HashMap.class, JsonViews.Standalone.class); } {code} was: It would be nice if I could select a custom data format for an individual REST DSL route to marshal objects differently. For example: Say I have a REST service that returns company data including the company's employees. But when I get an individual employee, I want to include the URI of the company in the response. So I defined a "json-standalone" data format that uses a different Jackson view. rest("/companies/{companyId}") .get() rest("/employees/{employeeId}") .get() .dataFormat("json-standalone") @Bean(name = "json-standalone") @Scope("prototype") public JacksonDataFormat dataFormat() { return new JacksonDataFormat(objectMapper, HashMap.class, JsonViews.Standalone.class); } > Support custom data formats on individual REST DSL routes > --------------------------------------------------------- > > Key: CAMEL-8720 > URL: https://issues.apache.org/jira/browse/CAMEL-8720 > Project: Camel > Issue Type: Wish > Components: rest > Affects Versions: 2.15.1 > Reporter: Stijn Van Bael > Priority: Major > > It would be nice if I could select a custom data format for an individual > REST DSL route to marshal objects differently. > For example: Say I have a REST service that returns company data including > the company's employees. But when I get an individual employee, I want to > include the URI of the company in the response. So I defined a > "json-standalone" data format that uses a different Jackson view. > {code} > rest("/companies/{companyId}") > .get() > rest("/employees/{employeeId}") > .get() > .dataFormat("json-standalone") > @Bean(name = "json-standalone") > @Scope("prototype") > public JacksonDataFormat dataFormat() { > return new JacksonDataFormat(objectMapper, HashMap.class, > JsonViews.Standalone.class); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.14#76016)