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

   Fixes [CAMEL-25079](https://issues.apache.org/jira/browse/CAMEL-25079): the 
route dumpers to YAML and Java (used by the dev console route-dump, JMX, 
`dumpRoutes`, camel-jbang and the TUI) produce invalid output. Found in a deep 
review; each fix has a test that fails without it (`LwModelToJavaDumperTest`, 
`YamlPrinterRoundTripTest` — which reads the output back with a YAML parser — 
and `YamlWriterEdgeCasesTest`).
   
   1. **The Java dump of a route template, rest, route configuration or rest 
configuration is not valid Java** (such as `.routeTemplate().id("tpl")...`): 
the dumper used the generated generic writer instead of the Java DSL writers 
that `JavaDslCompileTest` already compiles.
   2. **The Java dump of a multi-line expression is not valid Java**: a line 
break was not escaped in the string literal.
   3. **The YAML dump is not valid YAML, or reads back as another value, for 
common strings**: a trailing colon (`log("Processing:")`), a leading `,` `]` 
`}`, a carriage return, a multi-line value whose first line starts with a 
space, more than one trailing line break, and text that YAML reads as a number 
(`007`, `+5`, `1.`, `.inf`).
   4. **The YAML dump turns text attributes into numbers**: `setHeader("007")` 
was dumped as `7`, `1e3` as `1000.0`, a template default `0800` as `800`. A 
value is now only written as a number when it is written as that number.
   5. **`dumpDataFormatsAsYaml` writes `dataFormats` twice and as one map**, so 
it could not be loaded and two data formats of the same kind overwrote each 
other. It is now a list, as the YAML DSL loads it.
   
   **Not changed (for a later look — these are in the generated writers)**
   - The YAML dump of a rest loses the verb (get/post) and uses keys the YAML 
DSL does not accept (`verbs`, `params`, `responseMsgs`).
   - The YAML dump of route templates and templated routes uses 
`templateParameter`/`templateBean` and `parameter`/`bean` instead of 
`parameters`/`beans`.
   - The Java dump of `circuitBreaker` writes `onFallback` before the steps, so 
the steps go into the fallback.
   - `resolvePlaceholders` for routes created from templates uses the 
parameters of the last route (YAML) or none (Java).
   - `dumpBeansAsYaml` is built without escaping.
   
   The test suites of camel-yaml-io, camel-java-io, camel-core and 
camel-yaml-dsl pass.
   
   _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