Federico Mariani created CAMEL-26981:
----------------------------------------
Summary: camel-main: camel.dataformat.* options are not applied to
the data formats of the REST DSL binding
Key: CAMEL-26981
URL: https://issues.apache.org/jira/browse/CAMEL-26981
Project: Camel
Issue Type: Bug
Components: rest, camel-main
Affects Versions: 4.18.5, 4.23.0, 4.22.2
Reporter: Federico Mariani
Fix For: 4.24.0
With Camel Main (and Camel JBang), the {{camel.dataformat.<name>.*}} options
configure the data format that {{marshal().json()}} uses, but not the data
formats that the REST DSL binding creates for {{json}} and {{xml}} binding:
RestBindingAdviceFactory creates new instances and applies only
{{camel.rest.data-format-properties}} to them.
{code:java}
// application.properties: camel.dataformat.jackson.include = NON_NULL
restConfiguration().bindingMode(RestBindingMode.json);
rest("/pojo").get().outType(MyPojo.class).to("direct:pojo"); // returns MyPojo
with name = "a" and nick = null
{code}
The response is {{\{"name":"a","nick":null\}}}, while {{marshal().json()}} of
the same POJO gives {{\{"name":"a"\}}}. The request side is the same (e.g.
{{camel.dataformat.jackson.disable-features}}).
Expected: the REST binding data formats start from the options of the
configured data format, as route data formats do since CAMEL-22352, and
{{camel.rest.data-format-properties}} still take precedence.
_Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)