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


##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/OpenAPIInterfaceGenIT.java:
##########
@@ -51,4 +59,63 @@ void verifyOperationIdIsGeneratedByDefault() {
                 .body("paths.'/helloworld'.get.operationId", 
is("getAllProcessInstances_helloworld"));
     }
 
+    @ParameterizedTest
+    @ValueSource(strings = { "helloworld", "expression", "greet", "long-call", 
"squareService" })
+    void verifyProcessPrefixSchemasForMultipleWorkflows(String processId) {
+        String openapi =
+                RestAssured.given()
+                        .accept(ContentType.JSON)
+                        .when()
+                        .get("/q/openapi?format=json")
+                        .then()
+                        .statusCode(200)
+                        .extract()
+                        .asString();
+
+        JsonPath jp = new JsonPath(openapi);
+
+        Map<String, Object> schemas = jp.getMap("components.schemas");
+        assertTrue(schemas.containsKey("Expression Input"));
+        assertTrue(schemas.containsKey("Expression Output"));
+
+        Map<String, Object> inputSchema = 
jp.getMap("components.schemas['Expression Input']");
+        assertNotNull(inputSchema, "Input schema should exist for processId: " 
+ processId);
+        assertTrue(inputSchema.containsKey("type"), "Input schema should 
contain 'type' field for processId: " + processId);
+
+        List<String> postTags = jp.getList("paths.'/" + processId + 
"'.post.tags");
+        assertTrue(postTags.contains("Process - " + processId));
+
+        Map<String, Object> getProps = jp.getMap("paths.'/" + processId + 
"'.get.responses.'200'.content.'application/json'.schema.properties");
+        if (getProps != null) {
+            assertTrue(getProps.containsKey("workflowdata") || 
getProps.containsKey("id"));
+        }

Review Comment:
   OK, removing that part, we can just check schema is not null



##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/OpenAPIInterfaceGenIT.java:
##########
@@ -51,4 +59,63 @@ void verifyOperationIdIsGeneratedByDefault() {
                 .body("paths.'/helloworld'.get.operationId", 
is("getAllProcessInstances_helloworld"));
     }
 
+    @ParameterizedTest
+    @ValueSource(strings = { "helloworld", "expression", "greet", "long-call", 
"squareService" })
+    void verifyProcessPrefixSchemasForMultipleWorkflows(String processId) {
+        String openapi =
+                RestAssured.given()
+                        .accept(ContentType.JSON)
+                        .when()
+                        .get("/q/openapi?format=json")
+                        .then()
+                        .statusCode(200)
+                        .extract()
+                        .asString();
+
+        JsonPath jp = new JsonPath(openapi);
+
+        Map<String, Object> schemas = jp.getMap("components.schemas");
+        assertTrue(schemas.containsKey("Expression Input"));
+        assertTrue(schemas.containsKey("Expression Output"));
+
+        Map<String, Object> inputSchema = 
jp.getMap("components.schemas['Expression Input']");
+        assertNotNull(inputSchema, "Input schema should exist for processId: " 
+ processId);
+        assertTrue(inputSchema.containsKey("type"), "Input schema should 
contain 'type' field for processId: " + processId);
+
+        List<String> postTags = jp.getList("paths.'/" + processId + 
"'.post.tags");
+        assertTrue(postTags.contains("Process - " + processId));
+
+        Map<String, Object> getProps = jp.getMap("paths.'/" + processId + 
"'.get.responses.'200'.content.'application/json'.schema.properties");
+        if (getProps != null) {
+            assertTrue(getProps.containsKey("workflowdata") || 
getProps.containsKey("id"));
+        }
+    }
+
+    @Test
+    void verifyOperationsWithoutProcessPrefixAreNotModified() {
+        String openapi =
+                RestAssured.given()
+                        .accept(ContentType.JSON)
+                        .when()
+                        .get("/q/openapi?format=json")
+                        .then()
+                        .statusCode(200)
+                        .extract()
+                        .asString();

Review Comment:
   OK, time is not significant, but it's less verbose



-- 
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