fjtirado commented on code in PR #3756:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3756#discussion_r1824380574
##########
kogito-serverless-workflow/kogito-serverless-workflow-builder/src/main/java/org/kie/kogito/serverless/workflow/parser/handlers/ActionNodeUtils.java:
##########
@@ -34,16 +34,21 @@ public class ActionNodeUtils {
return
embeddedSubProcess.actionNode(context.newId()).name(functionDef.getName());
}
- public static void checkArgs(FunctionRef functionRef, String...
requiredArgs) {
+ public static boolean checkArgs(ParserContext context, FunctionRef
functionRef, String... requiredArgs) {
JsonNode args = functionRef.getArguments();
+ boolean isOk = true;
if (args == null) {
- throw new IllegalArgumentException("Arguments cannot be null for
function " + functionRef.getRefName());
- }
- for (String arg : requiredArgs) {
- if (!args.has(arg)) {
- throw new IllegalArgumentException("Missing mandatory " + arg
+ " argument for function " + functionRef.getRefName());
+ context.addValidationError("Arguments cannot be null for function
" + functionRef.getRefName());
+ isOk = false;
+ } else {
+ for (String arg : requiredArgs) {
+ if (!args.has(arg)) {
+ context.addValidationError("Missing mandatory " + arg + "
argument for function " + functionRef.getRefName());
+ isOk = false;
+ }
}
}
+ return isOk;
Review Comment:
all missing mandatory parameters should be collected, that's the reason for
the isOk flag.
--
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]