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

   ## Summary
   
   Replaces the 600-line hand-written `YamlWriter` (with 43+ hardcoded special 
cases and Jackson dependency) with a **generated** `YamlModelWriter` that 
builds `JsonObject`/`JsonArray` structures directly from model classes and 
serializes them via `YamlPrinter`. This is a follow-up to #23393 which fixed 
the symptoms — this PR eliminates the root cause.
   
   **New pipeline (2 conversions):**
   ```
   Model → Generated YamlModelWriter → JsonObject/JsonArray → YamlPrinter → 
YAML String
   ```
   
   **Old pipeline (6 conversions):**
   ```
   Model → Generated ModelWriter → YamlWriter.startElement/endElement
         → EipModel metadata → EipNode → JsonObject → JSON String
         → Jackson ObjectMapper → JsonNode → Jackson YAMLMapper → YAML String
         → post-process (strip indent)
   ```
   
   ### Key changes:
   - New Velocity template `model-yaml-writer.vm` that generates `doWrite*` 
methods returning `JsonObject` instead of emitting XML-style 
`startElement`/`endElement`
   - New `YamlDirectModelWriterGeneratorMojo` Maven mojo that generates 
`YamlModelWriter.java` (3900+ lines, covers all 300+ model classes)
   - New `YamlModelWriterSupport` base class with helper methods for building 
`JsonObject` structures
   - New `YamlPrinter` for serializing `JsonObject`/`JsonArray` to block-style 
YAML (no Jackson)
   - `LwModelToYAMLDumper` now uses `YamlModelWriter` instead of old 
`ModelWriter` pipeline
   - **Property classification happens at code-generation time**, not runtime — 
eliminating the root cause of circuitBreaker, REST DSL, and routeConfiguration 
YAML dump bugs
   
   ## Test plan
   - [x] All 93 existing tests in `camel-yaml-io` pass
   - [x] All 10 `DumpModelAsYaml*` tests in `camel-core` pass
   - [x] `ManagedCamelContextDumpRoutesAsYamlTest` passes (3 tests)
   - [x] `DumpRoutesTest` in `camel-endpointdsl` passes
   - [x] All 42 Yaml/Dump related tests in `camel-core` pass
   - [x] `YamlPrinter` has 11 dedicated unit tests for YAML quoting edge cases
   - [ ] Manual test with `camel validate normalize` on example routes
   
   _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