Contact Us 1-800-596-4880

DataWeave 2.5.0 Release Notes

DataWeave is the programming language designed by MuleSoft for data transformation. It is also the expression language Mule runtime engine uses to configure components and connectors.

For more detail, see DataWeave Language.

January, 2024

DataWeave 2.5.2 is bundled with the Mule 4.5.3 release. The Mule patch release addresses the following DataWeave issues:

Issue Resolution ID

An issue with ndson data format loading was fixed.

W-14471869

For details about the Mule release and patch updates, see Mule Runtime Engine 4.5.0 Release Notes.

November, 2023

DataWeave 2.5.1 is bundled with the Mule 4.5.1 release. The Mule patch release addresses the following DataWeave issues:

Issue Resolution ID

Temporary files are now closed for inputs bigger than 1.5 MB.

W-13868202

The cached function coercion now works correctly for a second time when an argument is constant.

W-13763138

The DataWeave sum function with a single numeric string arg now returns Number type instead of String.

W-14086694

Reading Avro schema with an array of enum type items no longer returns an error.

W-14252745

Inconsistent XML encoding detection no longer occurs between indexed and in-memory parsers.

W-13805995

For details about the Mule release and patch updates, see Mule Runtime Engine 4.5.0 Release Notes.

October 3, 2023

DataWeave 2.5.0 is bundled with the Mule 4.5.0 release. For details about the Mule release, see Mule Runtime Engine 4.5.0 Release Notes.

What’s New

The 2.5.0 version of DataWeave introduces the following new features and enhancements:

Support for backward compatibility with previous 2.x versions of DataWeave:

  • Compatibility flags retain previous DataWeave behavior at the Mule application level. For details, see DataWeave System Properties.

  • Syntax of an earlier version of DataWeave is supported through the %dw directive (such as %dw 2.4).

    Setting the directive to an earlier version of DataWeave avoids any syntax-breaking changes when the DataWeave runtime engine runs the script. This script-level setting enables you to retain earlier behavior in some scripts while using the latest behavior in others. DataWeave syntax did not change between DataWeave versions 2.1 through 2.4. See discussion of %dw in DataWeave Header.

Extended format support:

  • ProtoBuf format support is available. See Protobuf Format.

  • cXML support in the XML format is available for reading and creating doctype directives (DTDs). See XML Format.

Extended type support:

  • Loading type definitions from Java classes, JSON schemas, and XML schemas, and using the definitions in DataWeave scripts is supported. See Selecting Types.

  • Creating new DataWeave types from existing types is supported. See Reuse Types.

  • Specifying type parameters (similar to generics in other programming languages) of a function at the call site is supported. For details and examples, see Type Parameters and Work with Functions and Lambdas in DataWeave.

  • Introducing a Metadata Assignment Operator (<~) which enables you to set the metadata of any value without using the as operator. See Metadata Assignment Operator.

Memory management:

  • DataWeave now uses a centralized memory service provided by the Mule runtime when executing in that context.

DataWeave module features:

  • The Dtd module (dw::xml::Dtd) is new.

  • The toString function adds the locale parameter.

  • The Core annotation @UntrustedCode() changes to @UntrustedCode(privileges: Array<String>).

  • The concatWith function is new.

  • The version function is new.

Compatibility

The following table specifies which version of DataWeave is bundled with each Mule runtime engine release:

Mule Version DataWeave Version

4.6

2.6

4.5

2.5

4.4

2.4

4.3

2.3

4.2

2.2

4.1

2.1

3.9

1.2

3.8

1.1

3.7

1.0

Fixed Issues

The release addresses the following DataWeave issues and incorporates all patch updates from the 2.4.0 DataWeave release through September 2023:

Issue Resolution ID

The typeOf function now returns the underlying type value.

W-10648848

The lookup function is now deprecated.

W-12036895

Memory usage is now improved when using for each scope.

W-12245438

DataWeave now loads the Java class methods in deterministic order. Setting the property mule.dw.java_module_loader_deterministic_functions_ordering=false reverts the behavior.

W-13028728

Typed parameters validation now works properly when using generics.

W-10671626

Support is now added for negative Periods.

W-10989197

The onNull function now calls the right overload.

W-11327185

The literal type checking over escaped String is now improved.

W-11333111

The fromHex function is now improved to avoid carrying the base to be consistent with fromBase64 function.

W-11343563

The intersection of Object types at runtime now correctly matches the behavior of type checking phase.

W-11611304

Unnecessary materialization in pattern matching no longer occurs.

W-11698394

Trailing zeroes after the decimal point are now removed by default for JSON, YAML, CSV, and DataWeave formats. Setting minMuleVersion to 4.4.x or previous versions reverts the behavior.

W-11750379

The update operation dealing with Array and Object now works correctly when streaming is enabled.

W-12227568

The sum function now works correctly with an Array of non-numeric values.

W-12475183

The StackOverflow error on recursive function call with Object type argument no longer occurs.

W-13635914

The sqrt function now works correctly when working with floating point numbers.

W-11811398

The exception handling at sum, joinBy, dw::core::Arrays::countBy, and dw::core::Arrays::sumBy functions causing an invalid result is now removed. Setting the property com.mulesoft.dw.defaultOperator.disableExceptionHandling=true reverts the behavior.

W-12558946

The support for BOM marker on UTF-16 files is now improved.

W-12704857

The @Since annotation is now correctly processed in overloads. Setting the property mule.dw.functions.hide_based_on_language_level=false reverts the behavior.

W-12622236

A new set of functions is added to coerce a String to Date, DateTime, Time, or Number by a given format and locale. For example, dw::util::Coercions::toLocalDateTime.

W-12552422

The dw::core::Strings::unwrap function now works as expected.

W-12513180

The YAML module support for multiple documents is now improved.

W-12103386

The Java module support now avoids unnecessary input stream consumption.

W-12005692

The inferred type on Array now works correctly with conditional elements.

W-11404344

Pattern matching is now improved when dealing with Union types.

W-11590136

Ranges now support numbers without integer limitations.

W-11210592

Parsing of directives including comments now works correctly.

W-11132728

Type checking phase now works correctly over annotations.

W-11032792

DataWeave now ignores BOM marker on binary files.

W-10650435

The YAML module support of empty Object and empty Array is now improved.

DW-1093

Adding schema to Union types and others now works correctly.

DW-746

The function dw::core::Binaries::concatWith that allows the concatenation of two Binary values is now added.

DW-882

Tail recursive function recognition now works correctly when using the default operator.

DW-866

Coercion for Union and Literal type now works correctly.

DW-851

Data format resolver now works correctly to avoid unnecessary error messages.

SE-18503

Warning messages are now improved when coercing Union types.

DW-845

Upgrade

This version of DataWeave is bundled with Mule. DataWeave upgrades take place through Mule. See Mule Upgrades and Patch Updates.

See Also