From 4e0a24c9127989976d6b4b47ab949c0a98866566 Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Fri, 12 Sep 2025 11:08:06 +0200 Subject: [PATCH 1/2] handle functions in arrays --- python-sync-actions/src/configuration.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-sync-actions/src/configuration.py b/python-sync-actions/src/configuration.py index 1a63685..c2902c1 100644 --- a/python-sync-actions/src/configuration.py +++ b/python-sync-actions/src/configuration.py @@ -613,8 +613,11 @@ def perform_custom_function(self, key: str, function_cfg: dict, user_params: dic """ function_cfg = self.fill_in_time_references(function_cfg) + # if it's list process recursively + if isinstance(function_cfg, list): + return [self.perform_custom_function(key, item, user_params) for item in function_cfg] if not isinstance(function_cfg, dict): - # in case the function was evaluated as time + # in case the function was evaluated as time or is a primitive return function_cfg elif function_cfg.get("attr"): From 22b6a63d9964fcbde15f5a43e52b6dd3e22f492e Mon Sep 17 00:00:00 2001 From: Josef Kudera <46950237+kudj@users.noreply.github.com> Date: Fri, 12 Sep 2025 11:08:24 +0200 Subject: [PATCH 2/2] add test for functions in arrays --- .../012-params-list-func-eval/config.json | 61 ++++++++++++++ .../012-params-list-func-eval/orders.request | 3 + .../orders.requestHeaders | 4 + .../012-params-list-func-eval/orders.response | 82 +++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 python-sync-actions/tests/calls/012-params-list-func-eval/config.json create mode 100644 python-sync-actions/tests/calls/012-params-list-func-eval/orders.request create mode 100644 python-sync-actions/tests/calls/012-params-list-func-eval/orders.requestHeaders create mode 100644 python-sync-actions/tests/calls/012-params-list-func-eval/orders.response diff --git a/python-sync-actions/tests/calls/012-params-list-func-eval/config.json b/python-sync-actions/tests/calls/012-params-list-func-eval/config.json new file mode 100644 index 0000000..2eae5da --- /dev/null +++ b/python-sync-actions/tests/calls/012-params-list-func-eval/config.json @@ -0,0 +1,61 @@ +{ + "storage": {}, + "parameters": { + "__SELECTED_JOB": "0", + "config": { + "jobs": [ + { + "endpoint": "012-params-list-func-eval/orders", + "dataType": "orders", + "method": "POST", + "params": { + "greeting": { + "values": [ + { + "hi": { + "function": "concat", + "args": [ + "hello", + "-world" + ] + } + }] + + } + } + } + ], + "debug": false, + "outputBucket": "in.c-", + "incrementalOutput": false, + "#BEARER_TOKEN": "token" + }, + "api": { + "baseUrl": "http://mock-server:80/", + "http": { + "headers": { + "Authorization": { + "attr": "#BEARER_TOKEN" + } + } + } + }, + "http": { + "maxRetries": 10, + "codes": [ + 500, + 502, + 503, + 504, + 408, + 420, + 429 + ] + } + }, + "action": "test_request", + "image_parameters": { + }, + "authorization": { + } +} diff --git a/python-sync-actions/tests/calls/012-params-list-func-eval/orders.request b/python-sync-actions/tests/calls/012-params-list-func-eval/orders.request new file mode 100644 index 0000000..186c555 --- /dev/null +++ b/python-sync-actions/tests/calls/012-params-list-func-eval/orders.request @@ -0,0 +1,3 @@ +POST /012-params-list-func-eval/orders + +{"greeting": {"values": [{"hi": "hello-world"}]}} \ No newline at end of file diff --git a/python-sync-actions/tests/calls/012-params-list-func-eval/orders.requestHeaders b/python-sync-actions/tests/calls/012-params-list-func-eval/orders.requestHeaders new file mode 100644 index 0000000..b3e906c --- /dev/null +++ b/python-sync-actions/tests/calls/012-params-list-func-eval/orders.requestHeaders @@ -0,0 +1,4 @@ +accept: */* +authorization: token +content-length: 49 +content-type: application/json diff --git a/python-sync-actions/tests/calls/012-params-list-func-eval/orders.response b/python-sync-actions/tests/calls/012-params-list-func-eval/orders.response new file mode 100644 index 0000000..71d78ff --- /dev/null +++ b/python-sync-actions/tests/calls/012-params-list-func-eval/orders.response @@ -0,0 +1,82 @@ +{ + "nested": { + "orders": [ + { + "id": 1, + "customer": "John Doe", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + }, + { + "id": 2, + "customer": "Jan Novak", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + }, + { + "id": 3, + "customer": "Jana Novakova", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + }, + { + "id": 4, + "customer": "Bob Smith", + "address": "123 Main St", + "items": [ + { + "id": 1, + "name": "Widget", + "price": 9.99, + "quantity": 2 + }, + { + "id": 2, + "name": "Thing", + "price": 5.99, + "quantity": 5 + } + ] + } + ] + } +} \ No newline at end of file