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

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

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

Preliminary analysis confirms the bug. LwModelToYAMLDumper.java on main handles 
top-level onException extraction (added in CAMEL-25490) but does NOT apply the 
same treatment to errorHandler, 
intercept/interceptFrom/interceptSendToEndpoint, and onCompletion. 
Specifically: errorHandler is dropped entirely from the dump, intercept 
variants are dropped (they are injected into route outputs by 
RouteDefinitionHelper but only onException is filtered and re-promoted to top 
level), and onCompletion is written as a route step rather than a top-level 
entry. The fix pattern is clear: mirror the collectContextScopedOnExceptions 
logic for all three construct types. YamlModelWriter already has all needed 
write methods.

_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