lizhimins commented on PR #5843: URL: https://github.com/apache/rocketmq-dashboard/pull/5843#issuecomment-6120395920
Thanks — the analysis is right and the validation gap is genuine: `schemaFlagName` falls back to `toFlagName(name)`, which maps `_` to `-`, so a property named `_mode` would derive `-mode`, which `validCLIFlag` (`main.go:876-886`) rejects on every sibling path but not on this one, so the generator would emit `Flag: "-mode"` and `rmqctl explain` would advertise `---mode`. We are not going to land it in this form, for two reasons. 1. Nothing can trigger it with the catalog as it is defined today. We replayed `toFlagName` + `validCLIFlag` over all 1201 property keys in the 14 shards under `server/src/main/resources/tool-catalog/tools/` and none of them derives an unusable flag, so this guards a case the current data cannot produce. 2. The underlying divergence sits one level up, and fixing it removes this case by construction: the Go `validate()` in `rmqctl/internal/catalog/generate/main.go` does not enforce the `requiredCapabilities` pattern that `rmq-tools.schema.json:87-93` declares (`^[A-Z][A-Z0-9_]*$`) — it only enum-checks `riskLevel` (`main.go:627`), so the schema and the generator's own validator have drifted apart. A PR that makes `validate()` enforce the schema's patterns would be the better place for this, and we would review it quickly. For what it is worth, the check itself is written well; one refinement if you do pursue it — matching `derived from its name` instead of the substring `"invalid CLI flag"` would pin the message you actually added, since that substring is shared with the explicit-`x-cli-flag` error. #5837 is being merged separately (it fixes a digest that is wrong today), so the `main_test.go` insertion-point conflict between the two no longer matters. -- 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]
