You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/09/02 09:03:00 UTC

[jira] [Resolved] (CAMEL-8720) Support custom data formats on individual REST DSL routes

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

Claus Ibsen resolved CAMEL-8720.
--------------------------------
    Resolution: Won't Fix

this will make the rest-dsl too complex

> 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
(v8.20.10#820010)