123123213weqw opened a new pull request, #5843:
URL: https://github.com/apache/rocketmq-dashboard/pull/5843

   ## Why
   `validateSchema` validated explicit `x-cli-flag` values with `validCLIFlag` 
but never checked flags *derived* from property names via `toFlagName`. A 
property named `_mode` (legal for JSON Schema, and the catalog's own 
`rmq-tools.schema.json` leaves `inputSchema` property names entirely 
unconstrained) passes validation and the generator emits `{Name: "_mode", Flag: 
"-mode", ...}`. That flag cannot be bound by cobra as a usable `--mode`, and 
`rmqctl explain <resource>` would advertise it as `---mode`. Every sibling 
constraint (reserved names, duplicates, invalid `x-cli-flag`) is validated, so 
this one gap silently ships an unusable flag.
   
   ## What changed
   - `validateSchema` now runs `validCLIFlag` on the *resolved* flag name 
(explicit `x-cli-flag` or the derived one) for every leaf property, rejecting 
catalogs that would generate unusable flags with a targeted error message.
   
   ## Validation
   - New red-first test `TestRunRejectsPropertyWithUnusableDerivedFlag`: a 
`_mode` property previously generated `Flag: "-mode"` and the generator exited 
0; it now fails with `invalid CLI flag` and writes no output.
   - `make catalog-verify` still passes (every derived flag in the real catalog 
is already valid), `go build ./...`, `go vet`, `gofmt` clean, full generate 
package tests pass.


-- 
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]

Reply via email to