zjncs opened a new pull request, #6200:
URL: https://github.com/apache/rocketmq-dashboard/pull/6200

   ### What
   
   `rmqctl/cmd/catalog_validate.go` — the validator every tool invocation runs 
before dispatch (`validateSchemaArguments` + `validateAnyOf` + `validateValue` 
+ `argumentPresent` + `fieldArgumentHint`) — had no direct test. This adds 12 
tests pinning the contract:
   
   - **required-field presence**: a missing required field names its flag in 
the error; **blank strings, whitespace strings and `nil` all count as absent** 
while non-string values count as present;
   - **undeclared arguments are tolerated** (the validator only checks declared 
fields);
   - **object fields**: a non-object value is rejected, and **validation 
recurses into the object's children** (a required child of an object is 
enforced);
   - **`minLength` counts runes, not bytes** — two CJK runes satisfy a minimum 
of two;
   - **enum membership** lists the allowed values on rejection;
   - **the numeric minimum applies to numbers only** (`int64` and `float64` 
at/above pass, below fails with `must be at least %g`, and a string value skips 
the numeric check);
   - **anyOf groups**: any single satisfied group passes; with none satisfied 
the error lists every group as `[--a + --b] OR [--c]`; a schema without groups 
requires nothing;
   - **field hints**: plain fields render as `--flag`, object fields as `object 
"name" (flags: --child)`.
   
   ### Verification
   
   - New tests on unmodified code: **12/12 passed** (`go test ./cmd/ 
-count=1`), `go vet ./cmd/` clean.
   - Discriminating mutations on the validator (4 tests red, 8 green):
     - drop the `TrimSpace` in `argumentPresent`: the blank/whitespace tests 
red;
     - `utf8.RuneCountInString` → `len`: the rune-count test reds (and the 
object recursion test follows);
     - invert the enum `slices.Contains`: the enum test reds.
   - Validator restored: full `./cmd/` package **ok** (all existing tests 
green).
   
   ### Collision check
   
   Checked against all open PRs — no other PR touches 
`rmqctl/cmd/catalog_validate.go` or adds `catalog_validate_test.go`.


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