Align the REST API OpenAPI spec with released Dashboard 6.1.5 - #110
Conversation
Remove the unreleased GET /jobs/{id} route and point queued-work status
at the mainwp/get-batch-job-status-v1 ability; document POST/PUT/PATCH
on the SSL Monitor, Domain Monitor, and Lighthouse action routes; add
the widgets, pagespeed, and multi-tokens Pro Reports data sets, make
the date range optional with its one-year default, and model the
multi_tokens template parameter; widen success to [0, 1] only on the
envelopes whose handlers return 0 inside HTTP 200; correct ToolJobStatus
error and timestamp types; replace the fictional 403 responses with the
401 the auth layer actually returns. Same corrections applied to the
extensions.mdx route tables.
…rding Bump the spec's info.version from the stale 6.1.3 to the released 6.1.5. Allow null in ToolJobStatus started_at and completed_at: the disconnect status handler reads a never-written started_at directly and falls back to null for completed_at while the job runs, unlike the empty-string fallback on the destroy and renew routes. Reword the queued-work notes: the batch-status ability is served over the WordPress Abilities API with WordPress authentication, so only a MainWP REST v2 route is missing, not a REST endpoint altogether.
WalkthroughThe API reference now targets version 6.1.5. It consolidates authorization responses, documents new update methods, expands Pro Reports, and describes updated success, queued-job, and background-job response schemas. ChangesAPI contract documentation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
api-reference/openapi.yaml (1)
237-243: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider one reusable response component for the 401 body.
The same 401 description and
Errorschema now repeat in every operation. A singlecomponents.responses.Unauthorizedentry, referenced with$ref, keeps the wording in one place and prevents drift when the text changes again. If this file is generated, apply the change in the generator instead.♻️ Proposed shared response component
components: responses: Unauthorized: description: The API key is missing, malformed, or disabled, or does not carry the permission this method needs. content: application/json: schema: $ref: '`#/components/schemas/Error`'Each operation then uses:
'401': $ref: '`#/components/responses/Unauthorized`'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@api-reference/openapi.yaml` around lines 237 - 243, Define one reusable components.responses.Unauthorized entry containing the existing 401 description and Error schema, or update the generator that produces this file if applicable. Replace each operation’s duplicated 401 response body with a $ref to components.responses.Unauthorized while preserving the existing 401 status.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@api-reference/openapi.yaml`:
- Around line 237-243: Define one reusable components.responses.Unauthorized
entry containing the existing 401 description and Error schema, or update the
generator that produces this file if applicable. Replace each operation’s
duplicated 401 response body with a $ref to components.responses.Unauthorized
while preserving the existing 401 status.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 55f8350a-c4a0-4417-96ed-882a0165132e
📒 Files selected for processing (2)
api-reference/openapi.yamlapi-reference/rest-api/extensions.mdx
The published
api-reference/openapi.yamldrifted from what Dashboard 6.1.5 serves. Each change below was verified against the 6.1.5 source and, where the route surface was in question, against a live Dashboard's route index.What changed
GET /jobs/{id}. No released Dashboard registers that route. Queued responses still return ajob_id; the spec now points status checks at themainwp/get-batch-job-status-v1ability on the WordPress Abilities API and notes that it uses WordPress authentication rather than the MainWP API key.WP_REST_Server::EDITABLE, so POST, PUT, and PATCH all work. The spec documented POST only. The route tables inextensions.mdxnow match.widgets,pagespeed, andmulti-tokensreport types (34 total).start_dateandend_dateare optional; the controller falls back to the last year when either is missing. Themulti_tokenstemplate parameter is now documented.successallows 0 on the three envelopes whose handlers report failures inside an HTTP 200 (Success,SuccessMessage,CountResult); the acknowledgement envelopes that hardcode 1 keep the tighter constraint.ToolJobStatus.errorsitems are{site_id, error}objects, and both timestamps allow the empty-string and null fallbacks the status handlers return while a job is running.info.versionbumped from the stale 6.1.3 to 6.1.5.Verification
mint broken-linkscleanclass-mainwp-rest-authentication.php, the v2 sites/settings/monitors controllers, and the four extension controllers)Review notes
The queued-work descriptions on
/sites/sync,/sites/{id_domain}/sync, and/updates/updatenow tell API-key clients there is no v2 status route to poll. That is accurate for 6.1.5, and the wording should be revisited if a jobs route ships in a later Dashboard release.Summary by CodeRabbit