Federico Mariani created CAMEL-25651:
----------------------------------------

             Summary: 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-yaml-dsl, camel-core
            Reporter: Federico Mariani


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