Skip to content

Incorrect validation with null-safe operator ? #10

@OKhalkov

Description

@OKhalkov

image

Transformation rule node: Script

// Create new map
var map = {
    "temperature": 42,
    "smth": 22,
        "nonExistingKey": {
            "smth": 22
        }
};

// Null-Safe expressions using ?
if (map.?nonExistingKey.smth > 10) {
    map.smth_check = true;
} else {
    map.smth_check = false;
}

// Iterate through the map
foreach(element: map.entrySet()) {
    // str = " " +str+ " "+ element.key+" "+element.value
    // Get the key
    element.key
    // // Get the value
    element.value;
}

// get map size
map.size();

return {msg: map};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions