This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 5947af7b8f5 NO-ISSUE: Dev deployment DMN form webapp not working when 
Dev deployment contains BPMN models (#2967)
5947af7b8f5 is described below

commit 5947af7b8f5984b3587d8dba6d09c8ff372bec80
Author: Tiago Bento <[email protected]>
AuthorDate: Thu Mar 6 17:13:56 2025 -0500

    NO-ISSUE: Dev deployment DMN form webapp not working when Dev deployment 
contains BPMN models (#2967)
---
 .../src/DmnDevDeploymentFormWebAppDataApi.tsx            | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/packages/dev-deployment-dmn-form-webapp/src/DmnDevDeploymentFormWebAppDataApi.tsx
 
b/packages/dev-deployment-dmn-form-webapp/src/DmnDevDeploymentFormWebAppDataApi.tsx
index 7126f62da62..f21ea3cf540 100644
--- 
a/packages/dev-deployment-dmn-form-webapp/src/DmnDevDeploymentFormWebAppDataApi.tsx
+++ 
b/packages/dev-deployment-dmn-form-webapp/src/DmnDevDeploymentFormWebAppDataApi.tsx
@@ -37,17 +37,25 @@ export async function fetchAppData(args: { 
quarkusAppOrigin: string; quarkusAppP
     await fetch(routes.quarkusApp.openApiJson.path({}, args.quarkusAppOrigin, 
args.quarkusAppPath))
   ).json();
 
-  // Append origin to schema $refs
+  // Append origin to schema $refs, but only on DMN paths
+  //
+  // It's important to skip paths not ending on `/dmnresult` because the 
application
+  // being deployed may have other paths that we don't control, and not all of 
them
+  // will have valid JSON Schemas.
   Object.keys(openApiSpec.paths).forEach((modelPath) => {
-    const inputSetSchemaRef = 
openApiSpec.paths[modelPath]?.post.requestBody.content["application/json"].schema.$ref;
-    const outputSetSchemaRef =
-      
openApiSpec.paths[modelPath]?.post.responses.default?.content["application/json"].schema.$ref;
+    if (!modelPath.endsWith("/dmnresult")) {
+      return;
+    }
 
+    const inputSetSchemaRef =
+      
openApiSpec.paths?.[modelPath]?.post?.requestBody?.content?.["application/json"]?.schema?.$ref;
     if (inputSetSchemaRef) {
       
openApiSpec.paths[modelPath].post.requestBody.content["application/json"].schema.$ref
 =
         `${args.quarkusAppOrigin}${inputSetSchemaRef}`;
     }
 
+    const outputSetSchemaRef =
+      
openApiSpec.paths?.[modelPath]?.post?.responses?.default?.content?.["application/json"]?.schema?.$ref;
     if (outputSetSchemaRef) {
       
openApiSpec.paths[modelPath].post.responses.default.content["application/json"].schema.$ref
 =
         `${args.quarkusAppOrigin}${outputSetSchemaRef}`;


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

Reply via email to