gmunozfe commented on code in PR #4026:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4026#discussion_r2276907064


##########
kogito-serverless-workflow/kogito-serverless-workflow-python-runtime/src/main/java/org/kie/kogito/serverless/workflow/python/PythonServiceWorkItemHandler.java:
##########
@@ -49,12 +50,21 @@ protected Object invoke(String moduleName, String 
methodName,
         // make sure module is imported
         py.exec("import " + moduleName);
         final String funcName = moduleName + "." + methodName;
-        if (parameters instanceof Map) {
-            return py.invoke(funcName, (Map<String, Object>) parameters);
-        }
+        Object result;
+
         if (parameters instanceof JsonNode) {
-            return py.invoke(funcName, JsonObjectUtils.convertValue((JsonNode) 
parameters, Map.class));
+            parameters = JsonObjectUtils.toJavaValue((JsonNode) parameters);
+        }
+        if (parameters instanceof Map) {
+            // keyword args call
+            result = py.invoke(funcName, (Map<String, Object>) parameters);
+        } else if (parameters instanceof Collection) {
+            // multiple unnamed parameters call
+            result = py.invoke(funcName, ((Collection) parameters).toArray());
+        } else {

Review Comment:
   you could add also a case for null parameters to be more strict (though this 
works the same)
   ```
   else if (parameters == null) {
       result = py.invoke(funcName);
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to