[
https://issues.apache.org/jira/browse/CAMEL-23757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-23757.
---------------------------------
Resolution: Fixed
> Add Java DSL model writer for full-circle DSL transformation (XML/YAML to
> Java DSL)
> -----------------------------------------------------------------------------------
>
> Key: CAMEL-23757
> URL: https://issues.apache.org/jira/browse/CAMEL-23757
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.21.0
>
>
> Camel has generated model writers for XML (ModelWriter in camel-xml-io) and
> YAML (YamlModelWriter in camel-yaml-io), both generated by Mojos extending
> ModelWriterGeneratorMojo in camel-package-maven-plugin. These take Camel
> Model objects and produce the target DSL output.
> What is missing is the reverse direction for Java DSL — a writer that takes
> Model objects and produces Java DSL source code. Since we already have
> parsers that read XML and YAML into Model objects, adding a Java DSL writer
> would enable full-circle transformation: Java <-> XML <-> YAML <-> Java.
> *Motivation:*
> - LLMs produce better output for Java DSL (most training data uses it) — a
> mechanical transform from XML/YAML via the Model ensures correctness
> - Migration path for teams moving from XML-based deployments to Java DSL
> - Round-trip validation (transform A->B->A and verify equivalence)
> - AI-assisted editing: edit in Java DSL (strongest LLM support), then
> transform back to user's preferred format
> *Implementation approach:*
> # New Mojo: JavaDslModelWriterGeneratorMojo extending ModelWriterGeneratorMojo
> # New Velocity template: model-java-writer.vm generating fluent Java DSL
> method chains
> # New runtime support class: JavaDslWriterSupport for string building,
> indentation, fluent chaining
> # New module or subpackage to host the generated JavaDslModelWriter
> # Tests using existing XML/YAML test fixtures as round-trip inputs
--
This message was sent by Atlassian Jira
(v8.20.10#820010)