You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2026/05/21 08:59:03 UTC

[PR] CAMEL-23596: Replace hand-written YamlWriter with generated direct YAML writer [camel]

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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23596: Replace hand-written YamlWriter with generated direct YAML writer [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #23407:
URL: https://github.com/apache/camel/pull/23407


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23596: Replace hand-written YamlWriter with generated direct YAML writer [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23407:
URL: https://github.com/apache/camel/pull/23407#issuecomment-4506713480

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `core/camel-yaml-io`
   - `dsl/camel-jbang/camel-jbang-plugin-validate`
   - `tooling/maven/camel-package-maven-plugin`
   
   > :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the `test-dependents` label to force testing all dependents.
   
   :white_check_mark: **POM dependency changes: targeted tests included**
   
   <details><summary>Modules affected by dependency changes (2)</summary>
   
   - `:camel-package-maven-plugin`
   - `:camel-yaml-io`
   
   </details>
   
   <details><summary>Build reactor — dependencies compiled but only changed modules were tested (3 modules)</summary>
   
   - Camel :: JBang :: Plugin :: Validate
   - Camel :: Maven Plugins :: Camel Maven Package
   - Camel :: YAML IO
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/26216181958)


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-23596: Replace hand-written YamlWriter with generated direct YAML writer [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23407:
URL: https://github.com/apache/camel/pull/23407#issuecomment-4506496860

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org