docs(api): sync API reference with the b3 router - #153
Merged
Conversation
Add tooling to diff the b3 API server against docs/platform/api, and apply
the drift the first run found.
Tooling (hack/api-doc-sync/, driven by /api-docs-sync):
- extract_routes.py walks the macaron registration call graph from
RegisterRoutes and RegisterMarketplaceServiceRoutes, so a helper called
inside an m.Group() gets the enclosing path prefix and middlewares.
- compare.py diffs the extracted routes against the md pages and
openapi.yaml, resolving the page-relative, multi-verb and abbreviated
heading forms these pages use.
- refresh_reference.py re-inlines openapi.yaml into reference/api.html,
which had no generator.
Corrections:
- user-dashboard.md documented /dashboard/clusters/*, but
registerBillingDashboardUserAPIs is called from inside the /user group,
so the served prefix is /user/dashboard/clusters. Renamed the 10
headings and the 9 matching openapi.yaml paths.
- The same endpoints require view:licensed_clusters, not view:contracts;
the two /events routes additionally require view:event_resources.
- /healthz and /.well-known/openid-configuration are registered on the
accounts router, which is mounted at /accounts - not at the host root as
documented. Replaced the OIDC example with the actual template output.
Newly documented (md + openapi.yaml):
- /orgs/{orgname}/auth-source (GET/POST/PUT/DELETE)
- /orgs/{orgname}/subscription (GET/POST/DELETE)
- /user/login-method, /user/orgs, /user/inbox/subscriptions
- /user/deploy/orders and its render/helm3/yaml routes, replacing a
placeholder that deferred to the source
- /clusters/{owner}/{cluster}/namespaces/{namespace}/resources
- the ui.kubedb.com databaseconfigurations raw passthrough
- /dashboard/monthly-summary/{resourceType}
Also records the per-verb authorization checks on the cluster, namespace
and resource subscription routes.
Every route the router registers is now covered by both the md pages and
the spec, except the /api/v1 catch-all 404 handler.
Signed-off-by: Arnob kumar saha <arnob@appscode.com>
|
Visit the preview URL for this PR (updated for commit 9e6bcde): https://kubedb-v2-hugo--pr153-arnob-api-docs-rik4xa4n.web.app (expires Thu, 10 Sep 2026 10:29:30 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 0f29ae8ae0bd54a99bf2b223b6833be47acd5943 |
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.
Adds tooling to diff the b3 API server against
docs/platform/api, and applies the drift the first run found.Tooling
hack/api-doc-sync/, driven by the/api-docs-syncslash command (.claude/commands/api-docs-sync.md). Python 3 stdlib only, exceptrefresh_reference.pywhich needs PyYAML.extract_routes.pyRegisterRoutes/RegisterMarketplaceServiceRoutes, so a helper called insidem.Group("/user", …)gets the/userprefix. Handles group nesting + group middlewares, gofmt-wrappedm.Combo(…).Get().Post()chains, bound payload types, inline comments. Currently 547 routes.compare.pyopenapi.yaml. Resolves the heading conventions these pages use — page-declared roots,PUT · PATCH /x,| POST/GET/DELETE |,/api/v1-prefixed table cells, and abbreviated.../kubeDb/views/xheadings.refresh_reference.pyopenapi.yamlas JSON intoreference/api.html(window.__SPEC__) and updates its paths/operations subtitle. That file was hand-maintained with no generator.Corrections
billing-dashboard/user-dashboard.mdhad every path wrong. It documented/dashboard/clusters/*, butregisterBillingDashboardUserAPIsis called from inside the/usergroup (routers/api/v1/user.go:66-68) while registering/dashboard/clusters(dashboard.go:70), so the served prefix is/user/dashboard/clusters. Renamed the 10 headings and the 9 matchingopenapi.yamlpaths.view:licensed_clusters, notview:contracts; the two/eventsroutes additionally requireview:event_resources./healthzand/.well-known/openid-configurationwere documented at the host root. Both are registered on the accounts router (routers/routes/routes.go:227-231), which is mounted at/accounts(cmd/api.go:125,AccountsSubURL = "/accounts"). The page's own "Verified 200" note recorded the console SPA catch-all, so it never proved the handler existed. Also replaced the OIDC discovery example with the actual template output.Newly documented (md +
openapi.yaml)GET/POST/PUT/DELETE /orgs/{orgname}/auth-source— the org SSO auth sourceGET/POST/DELETE /orgs/{orgname}/subscriptionGET /user/login-method(public),GET /user/orgs,GET /user/inbox/subscriptionsPOST /user/deploy/ordersplus itsrender/manifest,render/resources,helm3,yamlroutes — replacing a placeholder that deferred to the sourceGET /clusters/{owner}/{cluster}/namespaces/{namespace}/resourcesui.kubedb.comdatabaseconfigurationsraw passthroughGET /dashboard/monthly-summary/{resourceType}8 new schemas, 13 new spec paths.
subscriptions.mdalso gained the per-verb authorization checks it was missing (subscribe:cluster|namespace|resource, editor vs. viewer).Verification
compare.pyend state: code→md 1, code→openapi 1, openapi→code 0. The single entry both times isANY /*, the/api/v1catch-all 404 handler — not an endpoint.openapi.yamlparses and every$refresolves; 456 paths / 544 operations;reference/api.htmlregenerated to match.liche -p -h -l -sclean on every changed page.{history,status}-style cells — no genuine staleness.Request/response shapes were derived from the handlers and bound payload types, not guessed. No
> **Verified:**notes were added, since nothing here was exercised against a live deployment.