From 0b6bdbc43a2008dd1098ed6c3a86de3529a5b9bc Mon Sep 17 00:00:00 2001 From: lornakelly Date: Fri, 13 Nov 2026 12:29:36 +0000 Subject: [PATCH] Outer try catch task Signed-off-by: lornakelly --- .changeset/quick-banks-tap.md | 5 +++++ .../src/core/schemaWalker.ts | 2 ++ .../tests/core/schemaWalker.test.ts | 18 +++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .changeset/quick-banks-tap.md diff --git a/.changeset/quick-banks-tap.md b/.changeset/quick-banks-tap.md new file mode 100644 index 00000000..b178bef9 --- /dev/null +++ b/.changeset/quick-banks-tap.md @@ -0,0 +1,5 @@ +--- +"@openworkflowspec/diagram-editor": minor +--- + +Outer try catch task shows same panel as inner as it is all considered one task diff --git a/packages/open-workflow-diagram-editor/src/core/schemaWalker.ts b/packages/open-workflow-diagram-editor/src/core/schemaWalker.ts index d655c29a..d6e51531 100644 --- a/packages/open-workflow-diagram-editor/src/core/schemaWalker.ts +++ b/packages/open-workflow-diagram-editor/src/core/schemaWalker.ts @@ -46,6 +46,8 @@ export const NODE_TYPE_TO_DEF: Readonly> = { [GraphNodeType.Set]: "setTask", [GraphNodeType.Switch]: "switchTask", [GraphNodeType.Try]: "tryTask", + // The outer TRY…CATCH frame shows the same form as its inner Try / Catch frames. + [GraphNodeType.TryCatch]: "tryTask", [GraphNodeType.Wait]: "waitTask", [GraphNodeType.Catch]: "tryTask", [CATCH_CONTAINER_NODE_TYPE]: "tryTask", diff --git a/packages/open-workflow-diagram-editor/tests/core/schemaWalker.test.ts b/packages/open-workflow-diagram-editor/tests/core/schemaWalker.test.ts index 34a2a5c6..0d9d42a4 100644 --- a/packages/open-workflow-diagram-editor/tests/core/schemaWalker.test.ts +++ b/packages/open-workflow-diagram-editor/tests/core/schemaWalker.test.ts @@ -15,7 +15,12 @@ */ import { describe, expect, it } from "vitest"; -import { getFormFieldsForNodeType, partitionTaskBaseFields } from "../../src/core/schemaWalker"; +import { GraphNodeType } from "@openworkflowspec/sdk"; +import { + CATCH_CONTAINER_NODE_TYPE, + getFormFieldsForNodeType, + partitionTaskBaseFields, +} from "../../src/core/schemaWalker"; import { getTaskBaseKeys } from "../../src/core/schemaFilter"; import { TASK_TYPE_KEYS } from "../../src/core/taskTypes"; import { @@ -54,6 +59,17 @@ describe("taskBase partition", () => { ); }); +describe("try task frames", () => { + it.each([GraphNodeType.TryCatch, GraphNodeType.Catch, CATCH_CONTAINER_NODE_TYPE])( + "%s shows the same form as the Try frame", + (type) => { + expect(JSON.stringify(getFormFieldsForNodeType(type))).toBe( + JSON.stringify(getFormFieldsForNodeType(GraphNodeType.Try)), + ); + }, + ); +}); + describe("partitionTaskBaseFields", () => { const str = (path: string, label = path): FormFieldDescriptor => ({ kind: "string",