DataWeave 2.4.0 Release Notes

October 5, 2021

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.

What’s New

The 2.4.0 version of DataWeave introduces new features and enhancements.

Release notes for previous versions of DataWeave are available within Mule Runtime Release Notes.

New Features

  • Ability to read larger-than-memory strings automatically. When you are using the indexed reader strategy and processing a string with a size larger than 1.5 MB, DataWeave automatically splits the value in chunks to avoid out-of-memory issues. Related reader properties include com.mulesoft.dw.max_memory_allocation and com.mulesoft.dw.buffered_char_sequence.enabled. Refer to Indexed Readers in DataWeave.

  • New reader and writer properties for working with data formats. For example, the XML writer now enables you to define namespaces at the root level.

  • Many new modules, functions, types, annotations, and variables. Some are experimental and subject to change in future releases.

For additional detail, see What’s New in DataWeave

Enhancements

A number of DataWeave functions are overloaded to introduce new helper functions for handling null values.

Compatibility

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

Mule Version DataWeave Version

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 following table lists bug fixes that are specific to the initial release of DataWeave 2.4.0. This release also incorporates all fixes to DataWeave, including patch updates through the September 2021 release, that are listed in Mule Runtime 4.3.0 Release Notes.

Description Issue

Added the writeDeclaredNamespaces XML writer property to write all declared namespaces in the root element.

DW-16

Added the writeDeclaration YAML writer property to avoid writing the header declaration.

DW-162

Added a new Strings module for easier string data management.

DW-406

Added the constant folding functionality so that DataWeave replaces operations involving constant values with the actual result. For example, 1024*8 is replaced at compile time with the resulting value 8192.

DW-427

Added flow retyping to the type system, which enables better accuracy within flow-control structures featuring checks that involve typing.

DW-438

Added code inspectors so that quick fixes are suggested with best practices, such as replacing null checks with a default expression, or replacing sizeOf() == 0 with isEmpty().

DW-33/DW-632

Added an inspection to replace using with do blocks.

DW-771

Improved error messages when creating Java objects.

DW-565

Improved performance on floating point number parsing by identifying in advance if the number has a floating point or not.

SE-20614

Extended the common subexpression elimination process to work with index selectors.

SE-19934

Added functions that work with null values to the Core, Arrays, and String modules.

DW-425

Improved JSON performance by copying bytes from input to output directly during JSON-to-JSON data transformations.

DW-230

Improved YAML support of scalar types, string quotations, custom tags, and comment retention.

DW-687

Added the filterTree function to the Tree module to be able to filter any data structure.

DW-160

Added validations for index tokens in CSV format.

DW-577

Added support for the Java classes OptionalInt, OptionalDouble and OptionalLong.

DW-628

Added support for file:/example/file.txt as a valid URL.

DW-195

Added warning when using the design-time only format application/dw without dataOnly mode.

DW-873

Added experimental run and eval functions to dynamically execute scripts.

DW-170

Added the concept of optional function parameters in the type system.

DW-874

Improved CSV streaming to avoid unnecessary processing.

DW-876

Improved the mapObject function to avoid unnecessary processing.

DW-535

Improved the flatten function to avoid unnecessary processing.

DW-509

Improved code validation. Now an error returns when a variable is using the same name as an input.

DW-522

Improved the precision of math operations and added a property to retain the previous behavior: com.mulesoft.dw.math.exact_precision.

SE-16452

Improved handling of big XML files to fix potential I/O exceptions.

DW-250

Fixed error locations when scripts feature dynamic string selectors.

DW-875

Fixed a false negative error message when using multiple union types.

DW-297

The write function return types are now consistent with input types.

DW-298

The update operator no longer fails when working with repeated keys and attributes.

DW-306

Processing of XML documents with comments and streaming enabled now works as expected.

DW-307

DataWeave no longer fails to parse a single key-value pair with a conditional and parentheses.

DW-309

The type system now validates overloaded functions as parameters.

DW-316

Parallel processing on ndjson now works as expected.

DW-325

Fixed a materialization and streaming failure.

DW-368

Fixed the behavior of the slice function.

DW-409/DW-410

Fixed the ability to import namespaces from external modules.

DW-414

DataWeave now produces the error Division by Zero when dividing by 0.0 instead of an internal exception.

DW-415

DataWeave now properly validates that do blocks do not contain any reserved word declaration.

DW-416

Running flatten on flatten no longer causes loss of values.

DW-691

The update operator now works when no attribute is defined.

DW-216

Improved handling of binary data to prevent running out of memory when calculating sizes of processed data.

SE-16559

The com.mulesoft.dw.coercionexception.verbose property no longer logs data from coercion exceptions.

SE-15487

Using nested binary functions no longer produces a StackOverflow error.

SE-16092

DataWeave no longer returns UnsupportedOperationException when parsing an invalid script.

DW-294

Fixed a potential IndexOutOfBoundException when using overloaded functions with four parameters.

DW-159

Added support for dumping Flat File and Avro schemas when com.mulesoft.dw.dump_files is enabled.

DW-137

Improved code compilation. Implicit inputs are not added if a variable with the same name is explicitly defined.

DW-630

Upgrade

For upgrades to the 2.4.0 version of DataWeave, which is bundled within Mule runtime engine, see Upgrading Mule Runtime Engine (Versions 4.x to 4.n).

Was this article helpful?

💙 Thanks for your feedback!