[ 
https://issues.apache.org/jira/browse/CAMEL-25651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18127080#comment-18127080
 ] 

Guillaume Nodet commented on CAMEL-25651:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Code analysis confirmed: LwModelToYAMLDumper was fixed in CAMEL-25490 (commit 
197e70656a41) to correctly handle top-level onException, but the same treatment 
was NOT applied to errorHandler, 
intercept/interceptFrom/interceptSendToEndpoint, or onCompletion. These 
context-scoped constructs are injected into each route's outputs during 
RouteDefinitionHelper.prepareRouteImp(), but the YAML dumper does not extract 
them back out. The fix follows the exact same pattern as the onException fix.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-yaml-io - the route dump drops a top-level errorHandler and intercept, 
> and writes a top-level onCompletion as a route step
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25651
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25651
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-yaml-dsl
>            Reporter: Federico Mariani
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> Found while implementing CAMEL-25555 (camel validate normalize, one file per 
> input). The YAML dump used by {{camel validate normalize}} and 
> {{camel.main.dumpRoutes=yaml}} ({{DefaultDumpRoutesStrategy}} with 
> camel-yaml-io) does not round-trip three top-level elements:
> * a top-level {{errorHandler}} is dropped from the dump entirely;
> * a top-level {{intercept}} / {{interceptFrom}} / {{interceptSendToEndpoint}} 
> is dropped as well;
> * a top-level {{onCompletion}} is written as a step inside the first route, 
> which {{camel validate yaml}} rejects ("property 'onCompletion' is not 
> defined in the schema").
> A top-level {{onException}} is dumped correctly since CAMEL-25490. With 
> per-file normalize output (CAMEL-25555) the dump is now the main way the 
> command can change behaviour, and the scope warning the command prints can 
> only see what the dump contains.
> h3. Reproduction
> {code:yaml}
> - errorHandler:
>     deadLetterChannel:
>       deadLetterUri: log:dead
> - onCompletion:
>     steps:
>       - log: "done"
> - route:
>     from:
>       uri: timer:a
>       steps:
>         - log: "A"
> {code}
> {{camel validate normalize x.yaml}}: the errorHandler is missing from the 
> output, the onCompletion sits under the route's steps.
> h3. Fix
> Dump {{errorHandler}}, the intercepts and {{onCompletion}} as top-level 
> entries before the routes, as {{onException}} is, in the YAML (and XML) 
> dumper, with a round-trip test per element in camel-yaml-io or 
> camel-core-engine (dump, then load the dump).
> _Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to