zjncs opened a new issue, #5619:
URL: https://github.com/apache/rocketmq-dashboard/issues/5619
## Description
The frontend's nameserver upgrade call declares and posts the wrong field
(`web/src/api/cluster.ts:308-314`, passthrough
`web/src/services/clusterService.ts:372-384`):
```ts
export async function upgradeNameServer(data: {
clusterId: string;
addr: string;
version: string; // <-- the DTO field is targetVersion
}) {
await client.post('/nameservers/upgrade', data);
}
```
The backend contract is unambiguous:
- `UpgradeNameServerDTO` declares `@NotBlank(message = "targetVersion is
required") private String targetVersion;`
- `NameServerController.upgradeNameServer` consumes it with `@Valid`
- the Java service reads `command.getTargetVersion()`
(`ClusterService.java:611`)
So any caller following the function's declared type sends `version`,
Jackson silently drops the unknown key, and the `@NotBlank` validation rejects
the request with **400 "targetVersion is required"** — the API function can
never succeed.
First-hand demonstration on master (calling the function per its declared
signature, asserting the posted body):
```
expect(seen.targetVersion).toBe('5.3.1')
// AssertionError: expected undefined to be '5.3.1' (body carries `version`
instead)
```
No page currently calls the function (it is exported API surface), which is
why the break went unnoticed.
## Expected behavior
The function (both layers) declares and sends `targetVersion`, matching the
DTO.
## Environment
- branch: master (0228dad5)
- files: `web/src/api/cluster.ts`, `web/src/services/clusterService.ts`
--
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]