jamesnetherton opened a new pull request, #29559:
URL: https://github.com/apache/camel/pull/29559

   ## Summary
   
   Follow-up to #29461. Jackson 3 turns `FAIL_ON_UNKNOWN_PROPERTIES` off by 
default. With `camel-jackson3`, which Camel JBang now uses, the REST DSL 
binding of a service accepted a request body with properties its type does not 
have, and handed the route a POJO with empty fields. With Jackson 2 the body 
was rejected. Request bodies come from external callers, so the binding now 
enables the feature again when it reads them:
   
   - JSON: `RestBindingAdviceFactory` (camel-support), for the `json.in` data 
format.
   - XML: `JacksonXMLRestBindingJacksonXmlDataFormatFactory` 
(camel-jackson3xml), for the `xml.in` data format.
   
   ## Behaviour
   
   - The feature is not added when the bound `enableFeatures` or 
`disableFeatures` already names it, so 
`json.in.disableFeatures=FAIL_ON_UNKNOWN_PROPERTIES` still accepts unknown 
properties. Other enabled features are kept, and the feature is added to them.
   - Only request bodies are affected. The out data formats only marshal 
responses, and the REST producer, which reads the responses of the services it 
calls, keeps the Jackson 3 default.
   - Jackson 2 data formats are not changed.
   
   ## A mapper of your own is left alone
   
   When the data format has its own mapper (the `objectMapper` or `xmlMapper` 
option, or an auto-discovered mapper for JSON), the feature is not added. 
Elsewhere Camel applies `enableFeatures` on top of an explicitly set mapper. 
Here a user who supplies a mapper has chosen its settings, for example a shared 
mapper that accepts unknown properties, and REST binding should not override 
them silently.
   
   The upgrade guide replaces the 4.24 warning about accepted unknown 
properties with a note on this behaviour and how to opt out.
   
   ## Testing
   
   - camel-jetty: an unknown property is rejected and the route is not called, 
also when other features are enabled; a shared `JsonMapper` set through 
`json.in.objectMapper` keeps accepting unknown properties. The existing opt-out 
test still passes.
   - camel-jackson3xml: the same cases for XML, including an own `XmlMapper`.
   
   _Claude Code on behalf of jamesnetherton_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to