From 2b05535c2f8bd3360bf29ba4062bdeea90aad27e Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Mon, 28 Aug 2023 21:57:05 +0200 Subject: [PATCH] [KOGITO-9758] Supporting arrays as query parameters for openapi --- .../ClassAnnotatedWorkflowHandlerGenerator.java | 5 +++++ .../src/main/resources/specs/multiplication.yaml | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/ClassAnnotatedWorkflowHandlerGenerator.java b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/ClassAnnotatedWorkflowHandlerGenerator.java index 3a717c12ace..dbb78b47413 100644 --- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/ClassAnnotatedWorkflowHandlerGenerator.java +++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/ClassAnnotatedWorkflowHandlerGenerator.java @@ -26,6 +26,8 @@ import org.jboss.jandex.Type; import org.kie.kogito.codegen.api.context.KogitoBuildContext; +import com.github.javaparser.ast.NodeList; + import static com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType; import static com.github.javaparser.StaticJavaParser.parseType; @@ -46,6 +48,9 @@ protected final com.github.javaparser.ast.type.Type fromClass(Type param) { return parseClassOrInterfaceType(param.asClassType().name().toString()); case PRIMITIVE: return parseType(param.asPrimitiveType().name().toString()); + case PARAMETERIZED_TYPE: + return parseClassOrInterfaceType(param.asParameterizedType().name().toString()) + .setTypeArguments(NodeList.nodeList(param.asParameterizedType().arguments().stream().map(this::fromClass).collect(Collectors.toList()))); default: throw new UnsupportedOperationException("Kind " + param.kind() + " is not supported"); } diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/main/resources/specs/multiplication.yaml b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/main/resources/specs/multiplication.yaml index 295d1dc332e..fb63a5e67c3 100644 --- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/main/resources/specs/multiplication.yaml +++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/main/resources/specs/multiplication.yaml @@ -13,6 +13,13 @@ paths: schema: type: string required: true + - in: query + name: unusedList + required: false + schema: + type: array + items: + type: string requestBody: content: application/json: @@ -33,10 +40,15 @@ components: schemas: MultiplicationOperation: type: object + required: [leftElement,rightElement] properties: leftElement: format: float type: number rightElement: format: float - type: number \ No newline at end of file + type: number + unusedElement: + type: array + items: + type: string \ No newline at end of file