feat: keep api console request errors recoverable - #33
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54bf24bd23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const requestBodyError = page.getByRole('alert').filter({ | ||
| hasText: 'Resolve APISIX schema issues before sending.', | ||
| }); |
There was a problem hiding this comment.
Expect the malformed JSON alert text
This test fills the editor with {, but doExecute catches that in the JSON.parse block and renders the request-body alert with Fix request JSON before sending., returning before the APISIX schema feedback path can set Resolve APISIX schema issues before sending.. As written, the new E2E test will time out on this locator whenever it runs against the changed code; assert the JSON syntax error message here or use syntactically valid JSON that violates the schema.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Improves the APISIX Dashboard API Console (“Raw API”) UX so request-body validation failures (JSON parse errors and Zod schema issues) stay visible inline with actionable recovery controls, rather than being only transient toasts.
Changes:
- Adds an inline, persistent request-body error
<Alert>with “Format JSON” and “Reset to template” recovery actions. - Clears stale request-body errors on relevant user actions (editing body, changing method/resource/path, loading/restoring requests, etc.).
- Adds E2E coverage for “blocked before send” request validation + recovery flow.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/routes/raw_api/index.tsx | Tracks request-body validation errors in state and renders a recoverable inline error alert with formatting/reset actions. |
| src/routes/raw_api/index.module.css | Adds spacing for the new request-body error alert. |
| e2e/tests/api-console.spec.ts | Adds an E2E test to ensure blocked request validation errors remain visible and can be recovered via reset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {requestBodyError.details.slice(0, 5).map((detail) => ( | ||
| <li key={detail}>{detail}</li> | ||
| ))} |
| await uiFillMonacoEditor(page, requestEditor, '{'); | ||
|
|
||
| await page.getByRole('button', { name: /Send PUT/ }).click(); | ||
| await page | ||
| .getByRole('dialog', { name: `PUT /routes/${routeId}` }) | ||
| .getByRole('button', { name: 'Execute' }) | ||
| .click(); | ||
|
|
||
| const requestBodyError = page.getByRole('alert').filter({ | ||
| hasText: 'Resolve APISIX schema issues before sending.', | ||
| }); |
Summary
Verification