zjncs opened a new pull request, #5620:
URL: https://github.com/apache/rocketmq-dashboard/pull/5620
Closes #5619
## Problem
`UpgradeNameServerDTO` requires a non-blank `targetVersion` (the Java
service reads `command.getTargetVersion()`), but both frontend layers declared
the field as `version` — any caller following the type sent a body Jackson
silently stripped of the version entirely, and the request was **always
rejected with 400 "targetVersion is required"**. The function is exported API
surface with no page caller yet, which is why the break went unnoticed.
## Fix
Rename the field through both layers (`web/src/api/cluster.ts`,
`web/src/services/clusterService.ts`).
## Verification
- **Fail-before (first-hand, on master)**: calling the function per its
declared `version` signature and asserting the posted body —
`expect(seen.targetVersion).toBe('5.3.1')` → `AssertionError: expected
undefined to be '5.3.1'` (the body carries `version`, which the DTO does not
declare)
- **Pass-after**: the committed contract test calls `targetVersion` and pins
the body (`targetVersion` present, no stale `version` key) — passes; `tsc
--noEmit` clean with the rename propagated through both layers
- Backend contract cited: `@NotBlank(message = "targetVersion is required")`
+ `@Valid` on the controller
## Collision note
`cluster.ts` is touched only by #5151 (hunk @139, config-diff types) —
disjoint from ~308-330. `clusterService.ts` is touched only by our own #5486
(mock config region) — the upgrade passthrough at ~372-384 is disjoint. The new
test file has no occupants.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]