Skip to content

[codex] Show workflow validation API errors#899

Merged
sfmskywalker merged 2 commits into
release/3.8.0from
codex/use-validation-errors-ui
Jun 8, 2026
Merged

[codex] Show workflow validation API errors#899
sfmskywalker merged 2 commits into
release/3.8.0from
codex/use-validation-errors-ui

Conversation

@sfmskywalker

Copy link
Copy Markdown
Member

Summary

  • Parse plain JSON 400 responses from workflow definition save/retract/create calls into ValidationErrors.
  • Preserve Elsa Core validation messages such as errors.generalErrors so the existing workflow editor snackbar shows the actionable server message.
  • Add regression coverage for the duplicate HTTP endpoint payload reported in elsa-core#7678.

Why

Elsa Core already returns useful validation details for duplicate HTTP trigger endpoints, but Studio could surface the generic Refit ApiException text when the response is not materialized as ValidationApiException. The workflow editor already displays ValidationErrors; this change makes the service layer feed it the useful API messages.

Fixes elsa-workflows/elsa-core#7678 from the Studio UI side.

Validation

  • dotnet test src/modules/Elsa.Studio.Workflows.Tests/Elsa.Studio.Workflows.Tests.csproj
  • dotnet test src/modules/Elsa.Studio.Workflows.Tests/Elsa.Studio.Workflows.Tests.csproj --no-restore

Notes

A full browser repro was not run because it requires a configured Elsa backend with conflicting HTTP-trigger workflow definitions. The behavior is covered at the service conversion layer that feeds the existing editor snackbar.

@sfmskywalker sfmskywalker marked this pull request as ready for review June 8, 2026 09:26
@sfmskywalker sfmskywalker requested a review from Copilot June 8, 2026 09:26

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.

Pull request overview

This PR improves how Elsa Studio surfaces backend workflow validation errors by parsing plain JSON 400 Bad Request responses into ValidationErrors, allowing the existing editor snackbar to display actionable server messages (e.g., duplicate HTTP endpoint validation).

Changes:

  • Add ApiException.GetValidationErrors() that can extract messages from plain JSON error payloads (and delegates to the existing ValidationApiException path when applicable).
  • Update workflow definition save/retract/create service methods to catch ApiException for HTTP 400 and convert the response into ValidationErrors.
  • Add regression tests covering extraction of errors.generalErrors and fallback to message.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/modules/Elsa.Studio.Workflows.Tests/ValidationApiExceptionExtensionsTests.cs Adds regression tests for parsing validation messages from plain JSON ApiException content.
src/modules/Elsa.Studio.Workflows.Core/Domain/Services/WorkflowDefinitionService.cs Converts 400 ApiExceptions into ValidationErrors for create/retract flows.
src/modules/Elsa.Studio.Workflows.Core/Domain/Services/WorkflowDefinitionHistoryService.cs Converts 400 ApiExceptions into ValidationErrors for history retract flow.
src/modules/Elsa.Studio.Workflows.Core/Domain/Services/WorkflowDefinitionEditorService.cs Converts 400 ApiExceptions into ValidationErrors for editor save/retract flows.
src/modules/Elsa.Studio.Workflows.Core/Domain/Extensions/ValidationApiExceptionExtensions.cs Adds JSON parsing for ApiException bodies to extract error messages into ValidationErrors.

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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@sfmskywalker sfmskywalker merged commit c44c75a into release/3.8.0 Jun 8, 2026
3 checks passed
@sfmskywalker sfmskywalker deleted the codex/use-validation-errors-ui branch June 8, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants