camunda / feel-scala

FEEL parser and interpreter written in Scala
https://camunda.github.io/feel-scala/
Apache License 2.0
119 stars 46 forks source link

context put does not work correctly for path longer than 2 #835

Open tomasherout opened 2 months ago

tomasherout commented 2 months ago

Describe the bug

Function context put does not work correctly for path longer than 2. For path with length 1 or 2 it works correctly - it merge object with value on given path. For path longer than 2 it returns object with last two keys from path without previous data from given object.

To Reproduce

context:

{"x": {"z": "old"} }

expression:

context put(x, ["a", "b", "c"], "new")

result:

{"b": {"c": "new"}}

=> Key a is ignored and previous data {"z": "old"} are also dropped.

Expected behavior

{"z": "old", "a": {"b": {"c": "new"}}}

Environment

saig0 commented 2 months ago

@tomasherout thank you for raising it. :+1: I can confirm the behavior. :heavy_check_mark: