Enhance camel-datasonnet with utility functions and standard library#22156
Open
gnodet wants to merge 2 commits intoapache:mainfrom
Open
Enhance camel-datasonnet with utility functions and standard library#22156gnodet wants to merge 2 commits intoapache:mainfrom
gnodet wants to merge 2 commits intoapache:mainfrom
Conversation
Add inbound filtering of Camel-prefixed headers to prevent external mail headers from injecting internal Camel headers (e.g. CamelFileName). The outbound filter was already in place; this adds the same protection for inbound messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add new CML functions for null handling (defaultVal, isEmpty), type coercion (toInteger, toDecimal, toBoolean), date/time (now, nowFmt, formatDate, parseDate), and utilities (uuid, typeOf). Ship a camel.libsonnet standard library with string helpers (capitalize, trim, split, join, contains, startsWith, endsWith, replace, lower, upper), collection helpers (sum, sumBy, first, last, count, distinct, flatMap, sortBy, groupBy, min, max, take, drop, zip), and object helpers (pick, omit, merge, keys, values, entries, fromEntries). Update documentation with full reference for all new functions and the standard library. 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:
|
3 tasks
Contributor
Author
|
Related: the Claude Code on behalf of Guillaume Nodet |
gnodet
added a commit
that referenced
this pull request
Mar 20, 2026
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>
3 tasks
oscerd
approved these changes
Mar 20, 2026
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
Improve the DataSonnet language integration to make it more ergonomic for Camel users:
cml.defaultVal,cml.isEmpty), type coercion (cml.toInteger,cml.toDecimal,cml.toBoolean), date/time (cml.now,cml.nowFmt,cml.formatDate,cml.parseDate), and utilities (cml.uuid,cml.typeOf)camel.libsonnetstandard library — auto-discovered helper functions for strings (capitalize, trim, split, join, contains, startsWith, endsWith, replace, lower, upper), collections (sum, sumBy, first, last, count, distinct, flatMap, sortBy, groupBy, min, max, take, drop, zip), and objects (pick, omit, merge, keys, values, entries, fromEntries)All new functions are implemented through DataSonnet's existing
LibrarySPI — no parser or grammar changes required.Test plan
CmlFunctionsTest— 28 tests covering all new CML functions (null handling, type coercion, date/time, utilities, combined usage with body data)CamelLibsonnetTest— 11 tests covering thecamel.libsonnetstandard library (string ops, collection ops, object ops, combined transformation with body data)