-
Notifications
You must be signed in to change notification settings - Fork 11
Create Nested Editing Stories #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lornakelly
merged 9 commits into
open-workflow-specification:main
from
cheryl7114:nested-editing-stories-300
Aug 19, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ce124cd
feat: add nested editing sample workflows
cheryl7114 3c60c57
feat: add nested editing stories
cheryl7114 9780d0e
feat: add overview doc and configure SwitchLockedCases as read-only
cheryl7114 5130fa8
add changeset
cheryl7114 04581ce
fix: fix sample workflows
cheryl7114 bad8945
fix copilot complaints
cheryl7114 e63ed17
fix: fix tryTask render issue
cheryl7114 86281d3
docs: add documentation
cheryl7114 b559a45
docs: minor docs change
cheryl7114 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@openworkflowspec/diagram-editor": minor | ||
| --- | ||
|
|
||
| add nested editing sample workflows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/open-workflow-diagram-editor/stories/nested-editing/NestedEditing.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * Copyright 2021-Present The Open Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
| import { DiagramEditor } from "../features/DiagramEditor"; | ||
| import * as workflows from "./index"; | ||
|
|
||
| const meta = { | ||
| title: "Nested Editing/Workflows", | ||
| component: DiagramEditor, | ||
| parameters: { | ||
| layout: "fullscreen", | ||
| }, | ||
| render: (args, { globals }) => { | ||
| return <DiagramEditor {...args} colorMode={args.colorMode ?? globals.colorMode ?? "system"} />; | ||
| }, | ||
| } satisfies Meta<typeof DiagramEditor>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| const DEFAULT_STORY_ARGS = { | ||
| isReadOnly: false, | ||
| locale: "en" as const, | ||
| } as const; | ||
|
|
||
| const createWorkflowStory = (workflowContent: string): Story => ({ | ||
| args: { | ||
| ...DEFAULT_STORY_ARGS, | ||
| content: workflowContent, | ||
| }, | ||
| }); | ||
|
|
||
| export const AllTaskTypes: Story = createWorkflowStory(workflows.allTaskTypes); | ||
| export const CallEndpointUnion: Story = createWorkflowStory(workflows.callEndpointUnion); | ||
| export const CallHeadersMap: Story = createWorkflowStory(workflows.callHeadersMap); | ||
| export const ListenDeepNesting: Story = createWorkflowStory(workflows.listenDeepNesting); | ||
| export const NestedValidation: Story = createWorkflowStory(workflows.nestedValidation); | ||
| export const RunTaskArray: Story = createWorkflowStory(workflows.runTaskArray); | ||
| export const SetOpenMap: Story = createWorkflowStory(workflows.setOpenMap); | ||
| export const SwitchLockedCases: Story = { | ||
| args: { | ||
| ...DEFAULT_STORY_ARGS, | ||
| isReadOnly: true, | ||
| content: workflows.switchLockedCases, | ||
| }, | ||
| }; |
27 changes: 27 additions & 0 deletions
27
packages/open-workflow-diagram-editor/stories/nested-editing/Overview.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| {/* | ||
| * Copyright 2021-Present The Open Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */} | ||
|
|
||
| import { Meta } from "@storybook/addon-docs/blocks"; | ||
|
|
||
| <Meta title="Nested Editing/Overview" /> | ||
|
|
||
| # Nested Editing | ||
|
|
||
| These stories provide isolated environments for building and testing the nested editing system. | ||
| Each story targets a specific interaction pattern introduced by a particular task type or shape, | ||
| making it easy to develop, review, and regression-test editing behaviour without noise from unrelated features. | ||
|
|
||
| The **All Task Types** story includes all 12 task types (`call`, `set`, `run`, `wait`, `fork`, `listen`, `emit`, `for`, `try/catch`, `switch`, `do`, `raise`) in a single workflow, providing a reference for how each task appears in the diagram editor. | ||
24 changes: 24 additions & 0 deletions
24
packages/open-workflow-diagram-editor/stories/nested-editing/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| * Copyright 2021-Present The Open Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| export { default as allTaskTypes } from "./workflows/all-task-types.yaml?raw"; | ||
| export { default as callEndpointUnion } from "./workflows/call-endpoint-union.yaml?raw"; | ||
| export { default as callHeadersMap } from "./workflows/call-headers-map.yaml?raw"; | ||
| export { default as listenDeepNesting } from "./workflows/listen-deep-nesting.yaml?raw"; | ||
| export { default as nestedValidation } from "./workflows/nested-validation.yaml?raw"; | ||
| export { default as runTaskArray } from "./workflows/run-task-array.yaml?raw"; | ||
| export { default as setOpenMap } from "./workflows/set-open-map.yaml?raw"; | ||
| export { default as switchLockedCases } from "./workflows/switch-locked-cases.yaml?raw"; |
159 changes: 159 additions & 0 deletions
159
packages/open-workflow-diagram-editor/stories/nested-editing/workflows/all-task-types.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| # | ||
| # Copyright 2021-Present The Open Workflow Specification Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| document: | ||
| dsl: "1.0.3" | ||
| namespace: examples | ||
| name: all-task-types | ||
| version: "0.1.0" | ||
| use: | ||
| errors: | ||
| notFound: | ||
| type: https://example.com/errors/not-found | ||
| status: 404 | ||
| title: Resource Not Found | ||
| do: | ||
|
cheryl7114 marked this conversation as resolved.
|
||
| - callHttpTask: | ||
| call: http | ||
| with: | ||
| method: get | ||
| endpoint: https://api.example.com/users | ||
| headers: | ||
| Accept: application/json | ||
| X-Api-Key: ${ .apiKey } | ||
| query: | ||
| page: "1" | ||
| limit: "20" | ||
| - setContextTask: | ||
| set: | ||
| userId: ${ .users[0].id } | ||
| userName: ${ .users[0].name } | ||
| fetchedAt: ${ now } | ||
| meta: | ||
| source: api.example.com | ||
| version: v2 | ||
| - runScriptTask: | ||
| run: | ||
| script: | ||
| language: javascript | ||
| arguments: | ||
| - --user-id | ||
| - ${ .userId } | ||
| environment: | ||
| NODE_ENV: production | ||
| code: | | ||
| const [,, flag, id] = process.argv; | ||
| console.log(JSON.stringify({ processed: id })); | ||
| - waitTask: | ||
| wait: | ||
| seconds: 5 | ||
| - forkTask: | ||
| fork: | ||
| compete: false | ||
| branches: | ||
| - notifyEmail: | ||
| call: http | ||
| with: | ||
| method: post | ||
| endpoint: https://api.example.com/notifications/email | ||
| body: | ||
| userId: ${ .userId } | ||
| - notifySlack: | ||
| call: http | ||
| with: | ||
| method: post | ||
| endpoint: https://api.example.com/notifications/slack | ||
| body: | ||
| userId: ${ .userId } | ||
| - listenTask: | ||
| listen: | ||
| to: | ||
| any: | ||
| - with: | ||
| type: com.example.user.verified | ||
| correlate: | ||
| userId: | ||
| from: .subject | ||
| - with: | ||
| type: com.example.user.rejected | ||
| correlate: | ||
| userId: | ||
| from: .subject | ||
| - emitTask: | ||
| emit: | ||
| event: | ||
| with: | ||
| source: https://api.example.com | ||
| type: com.example.user.processed.v1 | ||
| data: | ||
| userId: ${ .userId } | ||
| userName: ${ .userName } | ||
| - forTask: | ||
| for: | ||
| each: role | ||
| in: ${ .roles } | ||
| at: index | ||
| do: | ||
| - assignRole: | ||
| call: http | ||
| with: | ||
| method: post | ||
| endpoint: https://api.example.com/users/${ .userId }/roles | ||
| body: | ||
| role: ${ .role } | ||
| - tryTask: | ||
| try: | ||
| - fetchPreferences: | ||
| call: http | ||
| with: | ||
| method: get | ||
| endpoint: https://api.example.com/users/${ .userId }/preferences | ||
| catch: | ||
| errors: | ||
| with: | ||
| type: https://open-workflow-specification.org/spec/1.0.0/errors/communication | ||
| status: 404 | ||
| as: error | ||
| do: | ||
| - setDefaultPreferences: | ||
| set: | ||
| preferences: | ||
| theme: default | ||
| language: en | ||
| - switchTask: | ||
| switch: | ||
| - verified: | ||
| when: ${ .eventType == "com.example.user.verified" } | ||
| then: doNestedTask | ||
| - rejected: | ||
| when: ${ .eventType == "com.example.user.rejected" } | ||
| then: raiseErrorTask | ||
| - default: | ||
| then: raiseErrorTask | ||
| - doNestedTask: | ||
| do: | ||
| - enrichProfile: | ||
| call: http | ||
| with: | ||
| method: get | ||
| endpoint: https://api.example.com/profile/${ .userId } | ||
| - storeProfile: | ||
| set: | ||
| profile: ${ .body } | ||
| enrichedAt: ${ now } | ||
| then: exit | ||
| - raiseErrorTask: | ||
| raise: | ||
| error: notFound | ||
66 changes: 66 additions & 0 deletions
66
...es/open-workflow-diagram-editor/stories/nested-editing/workflows/call-endpoint-union.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # | ||
| # Copyright 2021-Present The Open Workflow Specification Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # Nested editing focus: endpoint union — the endpoint field can be a plain string URI | ||
| # or a structured object with uri + authentication. Both forms appear here so the | ||
| # editor can be tested switching between union variants inside nested do containers. | ||
| document: | ||
| dsl: "1.0.3" | ||
| namespace: examples | ||
| name: call-endpoint-union | ||
| version: "0.1.0" | ||
| do: | ||
| - prepareRequest: | ||
| set: | ||
| serviceToken: ${ .auth.token } | ||
| inputData: ${ .payload } | ||
| - callServices: | ||
| do: | ||
| - callPublicApi: | ||
| call: http | ||
| with: | ||
| method: get | ||
| endpoint: https://public.api.example.com/catalogue | ||
| query: | ||
| category: ${ .category } | ||
| - callSecureApi: | ||
| call: http | ||
| with: | ||
| method: post | ||
| endpoint: | ||
| uri: https://secure.api.example.com/process | ||
| authentication: | ||
| bearer: | ||
| token: ${ .serviceToken } | ||
| body: | ||
| payload: ${ .inputData } | ||
| - callOAuthApi: | ||
| call: http | ||
| with: | ||
| method: get | ||
| endpoint: | ||
| uri: https://oauth.api.example.com/data | ||
| authentication: | ||
| oauth2: | ||
| authority: https://auth.example.com | ||
| grant: client_credentials | ||
| client: | ||
| id: ${ .clientId } | ||
| secret: ${ .clientSecret } | ||
| - mergeResults: | ||
| set: | ||
| catalogue: ${ .catalogue } | ||
| processed: ${ .processed } | ||
| data: ${ .data } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.