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

   JIRA: [CAMEL-27052](https://issues.apache.org/jira/browse/CAMEL-27052)
   
   ### Problem
   
   The JAXB data format always read the `CamelJaxbPartClass` and 
`CamelJaxbPartNamespace` message headers, on unmarshal and marshal, and when 
set they took precedence over the `partClass` and `partNamespace` options. 
There was no way to turn this off, so a data format configured with a fixed 
`partClass` could still be switched to another class of its JAXB context by a 
header on the message. A `CamelJaxbPartClass` header alone also turned on 
partial unmarshalling on a data format without `partClass`.
   
   Other data formats with a similar header already make it opt-in: 
camel-jackson, camel-jacksonxml, camel-gson and others read their 
`CamelJacksonUnmarshalType` style header only when `allowUnmarshallType=true` 
(default `false`).
   
   ### Change
   
   - New option `allowPartClassFromHeader` (label advanced, default `false`) on 
the JAXB data format, in the model (`JaxbDataFormat` definition, builder) and 
the reifier.
   - `JaxbDataFormat` (camel-jaxb) reads the two headers only when the option 
is enabled. When it is disabled, the headers are ignored and the configured 
`partClass` and `partNamespace` apply. When it is enabled, the behaviour is as 
before.
   - The SOAP data format extends the JAXB data format, so it ignores these 
headers too by default. The option is added to the SOAP model (`SoapDataFormat` 
definition, builder) and its reifier as well, so it can be enabled from the DSL.
   - Docs: `jaxb-dataformat.adoc` describes the headers under the new option.
   - Upgrade guide: entry in `camel-4x-upgrade-guide-4_24.adoc`, as routes that 
set these headers must now enable the option.
   - Regenerated metadata, configurer, catalog, XML/YAML DSL parsers and 
schemas.
   
   ### Tests
   
   - New `JaxbPartClassHeaderOptionTest` (camel-jaxb): the part class header is 
ignored by default and the configured `partClass` is used; it is used when the 
option is enabled; a part class header alone does not turn on partial 
unmarshalling by default; the part namespace header is ignored by default on 
marshal and used when enabled. The three default-behaviour tests fail without 
the change in `JaxbDataFormat`.
   - Existing tests that set the headers in the route now enable the option: 
`JaxbDataFormatPartClassHeaderTest`, `JaxbPartClassHeaderStatePollutionTest` 
(camel-jaxb), `RestJettyNoContentTest`, `RestJettyNoContentRestConfigTest` 
(camel-jetty), `RestServletNoContentTest`, `RestServletNoContentRestConfigTest` 
(camel-servlet). The REST tests use 
`dataFormatProperty("xml.out.allowPartClassFromHeader", "true")`.
   - New `SoapAllowPartClassFromHeaderTest` (camel-soap): the option is off by 
default and is set on the SOAP data format from the model.
   
   Backports to camel-4.22.x and camel-4.18.x are handled in separate PRs 
(camel-4.18.x first needs CAMEL-24164).
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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