fix: correct ruleset type_ident registry in docs - #313
Closed
ysyneu wants to merge 2 commits into
Closed
Conversation
The store-ruleset endpoints validate `type_ident` against the store type registry (`store_types`: mysql, redis, elasticsearch, kafka, blackbox, mongodb, postgresql, os, minio, etcd), not the datasource type registry used by other monitor endpoints. `prometheus` is a datasource type, not a store type, and was never a valid value here. Update the three affected field descriptions in openapi.en.json and their Chinese counterparts in openapi.zh.json to name the correct registry, with `redis` as a valid example. Also correct the Rule Repository console docs (en/zh), which described the same feature using the wrong registry name and a `Prometheus` example.
Three more spots in the store-ruleset section of both openapi specs still named the wrong registry or used an invalid example value: - The `/monit/store/ruleset/list` operation description said "datasource type" instead of "store type". - `StoreRulesetListRequest`'s object-level description said "Filter rulesets by datasource type" while its own `type_ident` property already said "store type" — self-contradictory. - Every request/response example under the ruleset paths used `type_ident: "prometheus"`, which fails validation since `prometheus` is not a member of the store type registry. Changed to `redis`. No other "datasource" reference remains under the ruleset paths or schemas in either file; every other occurrence in the specs belongs to the actual datasource/rule endpoints, where it is correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
type_identfield on the store-ruleset endpoints (/monit/store/ruleset/create,/monit/store/ruleset/list, and the corresponding schemas) was documented as a datasource type identifier withprometheusas the example. That's the wrong registry.Why it's wrong
In
monit-webapi, rulesettype_identis validated against the store type registry, not the datasource registry:logic/logic_store.go(CreateRulesetandRulesetList) both callmodel.NewStoreTypeRepo(ctx).GetByIdent(ident), which reads thestore_typestable.store_typesis seeded (misc/sql/schema.sql) with exactly:mysql, redis, elasticsearch, kafka, blackbox, mongodb, postgresql, os, minio, etcd.prometheusis not among them under any casing.prometheusbelongs to a separateds_typestable, surfaced by the unrelatedPOST /monit/rule/dstypesendpoint (used by alert-rule/datasource fields elsewhere in the same spec).So the previously documented example (
type_ident: "prometheus") could never pass validation on this endpoint.Change
api-reference/openapi.en.json/openapi.zh.json: corrected every ruleset-scoped reference to the wrong registry —type_identfield descriptions on the ruleset request/response schemas (now say "store type", exampleredis)/monit/store/ruleset/listoperation description ("for a given store type")StoreRulesetListRequest's object-level description ("Filter rulesets by store type")type_ident: "prometheus"value, changed toredisLeft every "Datasource type identifier..." string elsewhere in the file untouched — those belong to the actual datasource/rule endpoints (
POST /monit/rule/dstypes,Allowed: prometheus, loki, mysql, ...), whereprometheusis correct. Re-grepped both full files fordatasource/数据源/Datasourceafter the change: no remaining hit falls under the ruleset paths or schemas.en/monitors/rule-repository/rule-repository.mdxandzh/monitors/rule-repository/rule-repository.mdx: the Rule Repository console page documents this same feature (the "New Ruleset" button maps to/monit/store/ruleset/create) and repeated the same wrong registry name andPrometheusexample — corrected consistently.Ran the repo's
scripts/lint_openapi.py:OK: 12 spec files, no violations.No tooling, scripts, or validation added — text correction only.