Add DataWeave to DataSonnet transpiler in camel-jbang#22157
Open
Add DataWeave to DataSonnet transpiler in camel-jbang#22157
Conversation
Add a `camel transform dataweave` CLI command that converts MuleSoft DataWeave 2.0 scripts into equivalent DataSonnet .ds files, enabling easier migration of Mule integrations to Apache Camel. The transpiler includes: - Hand-written recursive descent parser for DataWeave 2.0 syntax - AST-based conversion to DataSonnet with Camel CML functions - Support for field access, operators, type coercion, null handling, collection operations (map/filter/reduce/flatMap/groupBy/orderBy), string operations, if/else, var/fun declarations - Unsupported constructs flagged with TODO comments - 43 unit tests covering all conversion patterns CLI usage: camel transform dataweave --input flow.dwl --output flow.ds camel transform dataweave --input src/mule/ --output src/resources/ camel transform dataweave -e 'payload.name default "unknown"' Depends on PR #22156 (camel-datasonnet CML enhancements). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
oscerd
approved these changes
Mar 20, 2026
- Fix emitLambda: String.join was missing paramNames argument - Fix emitStringLit: remove double-escaping of backslashes - Fix startsWith/endsWith: use c.startsWith/c.endsWith from camel.libsonnet (DataSonnet std doesn't have these) - Fix orderBy: use c.sortBy from camel.libsonnet instead of std.sort - Fix min/max: use c.min/c.max from camel.libsonnet - Flag abs/round/sqrt as TODO (not available in DataSonnet std) - Remove unused KEYWORDS set from lexer - Add tests for startsWith, endsWith, escape preservation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add *.dwl to the license-maven-plugin excludes list since the plugin does not have a comment style definition for DataWeave files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
ℹ️ CI did not run targeted module tests (all projects built or tests skipped). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
camel transform dataweaveCLI command that converts MuleSoft DataWeave 2.0 scripts into equivalent DataSonnet.dsfiles, reducing the effort of migrating Mule integrations to Apache Camel.cml.defaultVal,cml.toInteger,cml.nowFmt, etc.) andcamel.libsonnethelpers// TODOcommentsCLI usage
camel transform dataweave --input flow.dwl --output flow.ds camel transform dataweave --input src/main/mule/ --output src/main/resources/ camel transform dataweave -e 'payload.name default "unknown"'Depends on
camel.libsonnetstandard library)Test plan
DataWeaveConverterTestcovering all conversion patternscamel-jbang-coretest suite passes (289 tests)