Skip to content

feat: Add full field support to emitTask form generation - #433

Open
handreyrc wants to merge 4 commits into
open-workflow-specification:feature/node-editingfrom
handreyrc:emitTask-form
Open

handreyrc wants to merge 4 commits into
open-workflow-specification:feature/node-editingfrom
handreyrc:emitTask-form

Conversation

@handreyrc

Copy link
Copy Markdown
Contributor

Closes #401

This PR introduces full field support to emitTask form generation in both read-only and edit mode.

Not Addressed in This PR

  • Layered validation (field-level and task-level).

Changes

  • Added support for emitTask multi-level field rendering, including source, time, dataschema, and data variants.
  • Adjusted the schema-to-form-field mapping to correctly handle the structure and variants of emitTask.
  • Transparent intermediate object wrappers are now eliminated, so nested fields are promoted to the correct level in the form tree.
  • Empty and unconstrained schema variants are now rendered as key-value editors instead of plain string inputs.

How to Test

  • Use the Examples / Workflows → Emit story in Storybook to validate emitTask in both read-only and edit mode.

Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploy Preview for openworkflow-editor ready!

Name Link
🔨 Latest commit cec59d5
🔍 Latest deploy log https://app.netlify.com/projects/openworkflow-editor/deploys/6aaabcf5bf038a000821ef04
😎 Deploy Preview https://deploy-preview-433--openworkflow-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Variant discrimination and unconstrained JSON handling currently produce incorrect form behavior for valid emit data.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds schema-driven emitTask form fields for read-only and edit modes.

Changes:

  • Adds emit event field variants and transparent wrapper handling.
  • Renders unconstrained variants as key-value maps.
  • Adds unit coverage and a minor changeset.
File summaries
File Description
schemaToFormFields.ts Extends variant mapping and wrapper elimination.
schemaToFormFields.test.ts Tests emit fields and endpoint variants.
.changeset/emitTask-form.md Records the feature release.
Review details

Suppressed comments (2)

packages/open-workflow-diagram-editor/src/core/schemaToFormFields.ts:815

  • Preserving every all-string variant leaves their discriminators indistinguishable: buildDiscriminator returns typeof data === "string" for each one, while OneOfFieldRow selects the first matching variant. Consequently one branch (for example URI versus Expression for source, dataschema, or time) can never be auto-selected correctly in read-only mode. These variants need mutually exclusive matching based on the runtime-expression syntax (and any other relevant schema constraints) before they are exposed separately.
  const allStrings = resolvedList.every((item) => item.kind === "string");
  if (allStrings && resolvedList.length > 1) {
    return resolvedList.map((item) => ({
      label: item.label,
      fields: item.fields,
      matchesData: item.matchesData,
    }));

packages/open-workflow-diagram-editor/src/core/schemaToFormFields.ts:763

  • ExpressionDataSchema is relabeled as “Expression” above, but it is not recognized here as a runtime expression (its ref/title is expressionDataSchema/ExpressionDataSchema, not runtimeExpression/RuntimeExpression). The dataschema Expression branch therefore gets isRuntimeExpression: false and loses the expression placeholder/styling. Include this schema in the runtime-expression detection.
        const isRe =
          (typeof c.$ref === "string" && c.$ref.includes("runtimeExpression")) ||
          resolved.title === "RuntimeExpression" ||
          RUNTIME_EXPRESSION_PATTERN.test(String(resolved.pattern ?? ""));
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/open-workflow-diagram-editor/src/core/schemaToFormFields.ts Outdated
Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants