bazaarvoice / jolt

JSON to JSON transformation library written in Java.
Apache License 2.0
1.54k stars 328 forks source link

Object referenced from ContextMap not passed to CustomFunction's args - ONLY IF REFERENCE IS IN THE LAST #1192

Open astrixsanath14 opened 1 year ago

astrixsanath14 commented 1 year ago

Hi! I am trying to pass a map as one of the argument to my custom function. When the reference is in the last, it send null, other wise send the correct map.

Error Spec:

[
  {
    "operation": "com.util.jolt.CustomModifier$Overwritr",
    "spec": {
      "timestamp_test_function_withContext": "=TimeStampTestFunction(@(1,timestamp_test_function), 'MM-dd-yyyy hh:mm:ss', ^contextMap, 1234))"
    }
  }
]

Error args[]: [06-29-2021 03:34:33, MM-dd-yyyy hh:mm:ss, null]

Working Spec:

[
  {
    "operation": "com.util.jolt.CustomModifier$Overwritr",
    "spec": {
      "timestamp_test_function_withContext": "=TimeStampTestFunction(@(1,timestamp_test_function), 'MM-dd-yyyy hh:mm:ss', ^contextMap, ''))"
    }
  }
]

Working args[]: [06-29-2021 03:34:33, MM-dd-yyyy hh:mm:ss, {file=_testing, TestEnum_NAME_VS_TYPE={one=ONE, two=TWO}, TestEnum_CODE_VS_TYPE={1=ONE, 2=TWO}}, '')]

Skimmed through evaluateArgsValue() but couldn't pinpoint what exactly causes this..