This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new a8d239c21144 CAMEL-25471: camel-datasonnet - rename
dataweave.libsonnet to camel-dataweave.libsonnet (#27596)
a8d239c21144 is described below
commit a8d239c211449422da02939c240ff2459dc50ed5
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Oct 9 08:08:27 2026 +0200
CAMEL-25471: camel-datasonnet - rename dataweave.libsonnet to
camel-dataweave.libsonnet (#27596)
DataSonnet libraries on the classpath are registered by file name, so a
user's own dataweave.libsonnet would replace the library the converted
DataWeave scripts import (or the other way around). Use a name that is
specific to Camel, before the library is released in 4.23.
Signed-off-by: Claus Ibsen <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
.../org/apache/camel/catalog/docs/datasonnet-language.adoc | 2 +-
.../camel-datasonnet/src/main/docs/datasonnet-language.adoc | 2 +-
.../resources/{dataweave.libsonnet => camel-dataweave.libsonnet} | 2 +-
.../org/apache/camel/component/dataweave/DataWeaveConverter.java | 8 ++++----
.../apache/camel/component/dataweave/DataWeaveConverterTest.java | 2 +-
.../modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/datasonnet-language.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/datasonnet-language.adoc
index 42633b395b39..af3222598ad6 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/datasonnet-language.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/datasonnet-language.adoc
@@ -529,7 +529,7 @@ camel transform dataweave --input src/main/resources/dwl/
--output src/main/reso
The converted script keeps the DataWeave semantics, which differ from plain
Jsonnet in important ways. For example, in
DataWeave a missing field, an index out of range or a selector on `null` gives
`null`, a field selector on an array
selects the field of every element (`payload.items.price`), and most functions
accept `null`. The converted script uses
-the `dataweave.libsonnet` library of camel-datasonnet for these semantics
(imported as `dw`), DataSonnet's `ds` library,
+the `camel-dataweave.libsonnet` library of camel-datasonnet for these
semantics (imported as `dw`), DataSonnet's `ds` library,
and the `cml` functions above.
The conversion either produces a script that gives the same result as the
DataWeave script, or fails:
diff --git a/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc
b/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc
index 42633b395b39..af3222598ad6 100644
--- a/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc
+++ b/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc
@@ -529,7 +529,7 @@ camel transform dataweave --input src/main/resources/dwl/
--output src/main/reso
The converted script keeps the DataWeave semantics, which differ from plain
Jsonnet in important ways. For example, in
DataWeave a missing field, an index out of range or a selector on `null` gives
`null`, a field selector on an array
selects the field of every element (`payload.items.price`), and most functions
accept `null`. The converted script uses
-the `dataweave.libsonnet` library of camel-datasonnet for these semantics
(imported as `dw`), DataSonnet's `ds` library,
+the `camel-dataweave.libsonnet` library of camel-datasonnet for these
semantics (imported as `dw`), DataSonnet's `ds` library,
and the `cml` functions above.
The conversion either produces a script that gives the same result as the
DataWeave script, or fails:
diff --git a/components/camel-datasonnet/src/main/resources/dataweave.libsonnet
b/components/camel-datasonnet/src/main/resources/camel-dataweave.libsonnet
similarity index 99%
rename from components/camel-datasonnet/src/main/resources/dataweave.libsonnet
rename to
components/camel-datasonnet/src/main/resources/camel-dataweave.libsonnet
index f3f401bcc49b..88c068bb7953 100644
--- a/components/camel-datasonnet/src/main/resources/dataweave.libsonnet
+++ b/components/camel-datasonnet/src/main/resources/camel-dataweave.libsonnet
@@ -15,7 +15,7 @@
* limitations under the License.
*/
// DataWeave semantics for DataSonnet, used by the DataWeave to DataSonnet
conversion (camel-dataweave).
-// Import with: local dw = import 'dataweave.libsonnet';
+// Import with: local dw = import 'camel-dataweave.libsonnet';
//
// In DataWeave a missing field, an index out of range and a selector on null
give null, a field selector on an
// array selects the field of every element, and most functions accept null.
In Jsonnet these are errors.
diff --git
a/components/camel-dataweave/src/main/java/org/apache/camel/component/dataweave/DataWeaveConverter.java
b/components/camel-dataweave/src/main/java/org/apache/camel/component/dataweave/DataWeaveConverter.java
index bc035eb34a68..0064db61b0d7 100644
---
a/components/camel-dataweave/src/main/java/org/apache/camel/component/dataweave/DataWeaveConverter.java
+++
b/components/camel-dataweave/src/main/java/org/apache/camel/component/dataweave/DataWeaveConverter.java
@@ -71,7 +71,7 @@ import
org.apache.camel.component.dataweave.DataWeaveAst.VarDecl;
/**
* Converts DataWeave 2.0 scripts to DataSonnet.
* <p>
- * The generated DataSonnet keeps the DataWeave semantics with the {@code
dataweave.libsonnet} library of the
+ * The generated DataSonnet keeps the DataWeave semantics with the {@code
camel-dataweave.libsonnet} library of the
* camel-datasonnet component (imported as {@code dw}): a selector on a
missing field, an index out of range or a
* {@code null} value gives {@code null}, a selector on an array selects from
every element, {@code default} applies to
* missing values, the core functions accept {@code null}, and so on.
@@ -82,7 +82,7 @@ import
org.apache.camel.component.dataweave.DataWeaveAst.VarDecl;
*/
public class DataWeaveConverter {
- private static final String DW_IMPORT = "local dw = import
'dataweave.libsonnet';\n";
+ private static final String DW_IMPORT = "local dw = import
'camel-dataweave.libsonnet';\n";
private static final Set<String> JSONNET_RESERVED = Set.of(
"assert", "else", "error", "false", "for", "function", "if",
"import", "importstr", "importbin", "in",
@@ -123,7 +123,7 @@ public class DataWeaveConverter {
"substringAfterLast", "substringBefore", "substringBeforeLast",
"underscore", "unwrap", "withMaxSize",
"wrapIfMissing", "wrapWith");
- // Functions of dataweave.libsonnet, by the number of arguments
+ // Functions of camel-dataweave.libsonnet, by the number of arguments
private static final Set<String> LIB_FUNCTIONS_1 = Set.of(
"upper", "lower", "trim", "sizeOf", "isEmpty", "isBlank",
"typeOf", "flatten", "keysOf", "namesOf",
"valuesOf", "entriesOf", "sum", "avg", "min", "max", "abs",
"round", "isEven", "isOdd", "isInteger",
@@ -200,7 +200,7 @@ public class DataWeaveConverter {
return convertedCount;
}
- /** Whether the converted DataSonnet imports {@code dataweave.libsonnet}.
*/
+ /** Whether the converted DataSonnet imports {@code
camel-dataweave.libsonnet}. */
public boolean needsDataWeaveLib() {
return needsDataWeaveLib;
}
diff --git
a/components/camel-dataweave/src/test/java/org/apache/camel/component/dataweave/DataWeaveConverterTest.java
b/components/camel-dataweave/src/test/java/org/apache/camel/component/dataweave/DataWeaveConverterTest.java
index 0d3f229a1acd..086b3004e9c9 100644
---
a/components/camel-dataweave/src/test/java/org/apache/camel/component/dataweave/DataWeaveConverterTest.java
+++
b/components/camel-dataweave/src/test/java/org/apache/camel/component/dataweave/DataWeaveConverterTest.java
@@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
class DataWeaveConverterTest {
- private static final String DW_IMPORT = "local dw = import
'dataweave.libsonnet';\n";
+ private static final String DW_IMPORT = "local dw = import
'camel-dataweave.libsonnet';\n";
private DataWeaveConverter converter;
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
index 4affa57ff94a..498efc029dec 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc
@@ -4971,7 +4971,7 @@ The conversion also follows the DataWeave semantics more
closely, which changes
scripts that were converted before. For example, a selector on a missing field
now gives `null` (as
in DataWeave) instead of failing, `default` applies to missing fields, and a
field selector on an array
selects the field of every element. Unknown functions and variables are no
longer passed through
-unchanged, but fail the conversion. The converted scripts use the new
`dataweave.libsonnet` library of
+unchanged, but fail the conversion. The converted scripts use the new
`camel-dataweave.libsonnet` library of
`camel-datasonnet`, so DataSonnet scripts generated with `camel transform
dataweave` need
`camel-datasonnet` 4.23 or newer.