Skip to content

Surface backend validation error messages inline in the Create-API wizard#1374

Open
IsuruGunarathne wants to merge 1 commit into
wso2:feature_nw_access_controlfrom
IsuruGunarathne:feature/nw-access-control-ui
Open

Surface backend validation error messages inline in the Create-API wizard#1374
IsuruGunarathne wants to merge 1 commit into
wso2:feature_nw_access_controlfrom
IsuruGunarathne:feature/nw-access-control-ui

Conversation

@IsuruGunarathne

Copy link
Copy Markdown
Contributor

Surface backend validation error messages inline in the Create-API wizard

What

When validate-openapi rejects a definition by URL or file (HTTP 400 with a reason in the response body), the Create-API wizard's .catch handlers dropped the backend reason to console.error and showed only a generic "validation failed" message — the Validation Errors card stayed empty. A 400 was thus surfaced less prominently than a 200 isValid:false, which renders the backend errors in the card.

Change

  • Add getValidationErrorsFromError() to thread the backend response.body.description into setValidationErrors() across the URL and file (API + MCP) rejection paths, so a rejected validation shows as prominently as the isValid:false path.
  • Clear stale validation errors on file-validation success.
  • Errors without a backend description return [] and keep the existing generic-message fallback.
  • Adds a unit test for the helper.

Testing

validationErrorUtils jest suite (2/2 passing) + full publisher portal build green against feature_nw_access_control.

Notes

  • Targets the feature_nw_access_control integration branch.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fda4471a-0795-4cfa-96e7-d744f1d44221

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

When validate-openapi rejects a definition by URL/file (HTTP 400 with a
reason in the response body), the wizard's .catch handlers dropped the
backend reason to console.error and showed only a generic "validation
failed" message - the Validation Errors card stayed empty. A 400 was thus
surfaced less prominently than a 200 isValid:false, which renders the
backend errors array in the card.

Add getValidationErrorsFromError() to thread the backend
response.body.description into setValidationErrors() across the URL and file
(API + MCP) rejection paths, so a rejected validation shows as prominently
as the isValid:false path. Also clear stale validation errors on
file-validation success. Errors without a backend description return [] and
keep the existing generic-message fallback.

Adds a unit test for the helper.
@IsuruGunarathne IsuruGunarathne force-pushed the feature/nw-access-control-ui branch from 2c10bb8 to ee5a286 Compare June 30, 2026 10:16
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@IsuruGunarathne

Copy link
Copy Markdown
Contributor Author

Quality Gate Failed Quality Gate failed

Failed conditions 3.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

This repetition comes from a few added lines landing inside the pre-existing API/MCP/URL validation handlers

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.

1 participant