From 5b77b7ae09f0bde119ac732afa8891a7ea6ba7b3 Mon Sep 17 00:00:00 2001 From: Paulo Martins Date: Tue, 5 Dec 2023 14:59:57 -0300 Subject: [PATCH] KOGITO-9978: Include components schemas in workflow schemas (#2079) --- .../src/__tests__/apis/apis.test.tsx | 3 +++ packages/runtime-tools-gateway-api/src/gatewayApi/apis.tsx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/runtime-tools-gateway-api/src/__tests__/apis/apis.test.tsx b/packages/runtime-tools-gateway-api/src/__tests__/apis/apis.test.tsx index 89d56da32a8..fc1eb2c6509 100644 --- a/packages/runtime-tools-gateway-api/src/__tests__/apis/apis.test.tsx +++ b/packages/runtime-tools-gateway-api/src/__tests__/apis/apis.test.tsx @@ -88,6 +88,9 @@ describe("swf custom form tests", () => { it("get custom workflow schema - success - with workflowdata", async () => { const schema = { + components: { + schemas: {}, + }, type: "object", properties: { name: { diff --git a/packages/runtime-tools-gateway-api/src/gatewayApi/apis.tsx b/packages/runtime-tools-gateway-api/src/gatewayApi/apis.tsx index ab155061dfb..b8efa0815cb 100644 --- a/packages/runtime-tools-gateway-api/src/gatewayApi/apis.tsx +++ b/packages/runtime-tools-gateway-api/src/gatewayApi/apis.tsx @@ -641,8 +641,8 @@ export const getCustomWorkflowSchemaFromApi = async ( // Components can contain the content of internal refs ($ref) // This keeps the refs working while avoiding circular refs with the workflow itself if (schema) { - const { [workflowName + "_input"]: _, components } = (api as any).components ?? {}; - (schema as any)["components"] = components; + const { [workflowName + "_input"]: _, ...schemas } = (api as any).components?.schemas ?? {}; + (schema as any)["components"] = { schemas }; } return schema ?? null;