zjncs opened a new pull request, #4571: URL: https://github.com/apache/rocketmq-dashboard/pull/4571
### Which Issue(s) This PR Fixes Revives #4186, which was closed during the #4225 tool-layer restructure — the gap it reported is still live at the tool's new home in `tool-catalog/tools/alert.yaml`. ### Brief Description `rmq.alert.rule.list` declares `metric` as a required output property with `minLength: 1`, but `AlertService` only validates `name` when a rule is created (`NativeAlertRulePolicy.validate` deliberately returns early on a blank metric), so a metric-less rule is a legal stored state. `AlertRuleListItem` serializes with `@JsonInclude(NON_NULL)`, so such a rule is emitted without a `metric` key, and `ToolValidationFilter` rejects the whole response with `required property 'metric' not found` — one metric-less rule breaks the entire `rmq.alert.rule.list` call. Align the schema with the service contract the same way `acl.yaml` already treats the nullable `gmtCreate`: drop `metric` from the required list and declare it `[string, 'null']` instead of `string` + `minLength: 1`. ### How Did You Test This Change? `cd server && mvn -B -ntp test -Dtest='ToolOutputSchemaContractTest' -Dspotbugs.skip=true` (Java 21), after adding a null-metric rule to the sweep's `rmq.alert.rule.list` sample: - before this change: `Tool output validation failed for rmq.alert.rule.list: [/items/1: required property 'metric' not found]` - after this change: `Tests run: 2, Failures: 0, Errors: 0` Full tool layer: `mvn -B -ntp test -Dtest='*Tool*Test' -Dspotbugs.skip=true` → `Tests run: 127, Failures: 0, Errors: 0`. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / `refactor:` / `chore:` / `docs:` / `perf:`) - [x] Tests added or updated for non-trivial changes, test methods named `...Test` - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (n/a — no UI change) - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit checks) - [x] New source files carry the ASF license header (n/a — no new files) - [x] Documentation touched where behaviour changed (n/a — schema now matches documented service behaviour) -- 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]
