davsclaus commented on PR #26103:
URL: https://github.com/apache/camel/pull/26103#issuecomment-5554621975
You're right — no model change is needed. The existing
`enableFeatures`/`disableFeatures` String properties already do the job, since
`doEnableFeaures()` and `doDisableFeatures()` resolve feature names by string.
The new typed Java overloads are pure compile-time convenience that ultimately
write into those same fields.
Here is what I'd like to see added to the test to demonstrate that the model
path works end-to-end (this is the style that YAML/XML DSL users will rely on):
```java
@Test
public void testEnableDatatypeFeatureViaModelString() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result-model");
mock.expectedMessageCount(1);
mock.message(0).body().isEqualTo("123");
template.send("direct:unformat-model", exchange ->
exchange.getIn().setBody(new Date(123)));
mock.assertIsSatisfied();
}
```
With a corresponding route using `setEnableFeatures` (the DSL/YAML-friendly
model property):
```java
JacksonDataFormat formatModel = new JacksonDataFormat();
formatModel.setEnableFeatures("WRITE_DATES_AS_TIMESTAMPS");
from("direct:unformat-model").marshal(formatModel).to("mock:result-model");
```
Also please fix the mock ordering in the existing and new tests —
`expectedMessageCount` must be set **before** `template.send()`, not after:
```java
// Correct ordering:
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
mock.message(0).body().isEqualTo("123");
template.send(...);
mock.assertIsSatisfied();
```
Also please update the Javadoc on `setEnableFeatures` and
`setDisableFeatures` to mention the newly supported types (`DateTimeFeature`,
`EnumFeature`, `JsonNodeFeature`) so users know they can pass these names as
strings in YAML/XML DSL too.
_Claude Code on behalf of davsclaus_
--
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]