123123213weqw opened a new pull request, #6390:
URL: https://github.com/apache/rocketmq-dashboard/pull/6390
@lizhimins This is the redirect you pointed at from #5843 and #5841: the
catalog generator's `validate()` now enforces what `rmq-tools.schema.json`
declares, so the JSON schema and the generator's own validator can no longer
drift apart.
## What
`validate()` checked several fields only for emptiness (or not at all) while
the schema constrained them with patterns:
- `name` — `^rmq\.[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$` (schema
`name.pattern`), previously only non-empty + unique;
- `cli.resource` / `cli.verb` — `^[a-z][a-z0-9-]*$`, previously only
non-empty;
- `permission` — `^[a-z][a-z0-9-]*(?::[a-z][a-z0-9-]*)+$`, previously only
non-empty;
- `requiredCapabilities` — items matched against `^[A-Z][A-Z0-9_]*$` plus
the schema's `uniqueItems`, previously unchecked entirely — which is the
divergence both closed PRs circled.
One more guard in the same spirit: `schemaFlagName` derives a flag from the
property name when `x-cli-flag` is absent, and `toFlagName` maps `_` to `-` —
so a property named `_mode` derives `-mode`, which `validCLIFlag` rejects on
the explicit-flag path but never checked on the derived one. A name-derived
flag now has to clear the same bar ("property %q derives an unusable CLI flag
%q from its name", pinned by test). All 1201 property keys in the 14 current
shards pass both the new pattern checks and the derived-flag check — `make
catalog-verify` is clean on today's catalog, so this tightens the gate without
touching any data.
## Test
`main_test.go` gains five red-first cases: non-conforming capability,
duplicate capability, non-conforming permission, non-conforming tool name, and
the `_mode`-derives-`-mode` property. `make catalog-verify`, `go test
./internal/catalog/...` and `go vet` are green.
--
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]