feat(swagger): add Chinese summaries and descriptions for routes

Replace generic "METHOD path" summaries with curated Chinese summaries
and longer descriptions, surfaced in Swagger UI. Adds a parity test that
fails when a new tenant-api route is wired up without a docs entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 10:06:05 +08:00
parent f9cf2b7cb2
commit f882ef8224
4 changed files with 417 additions and 1 deletions
+5 -1
View File
@@ -72,12 +72,16 @@ func BuildOpenAPI(routes gin.RoutesInfo, cfg Config) map[string]any {
tagSet[tag] = struct{}{}
operationID := uniqueOperationID(method+"_"+sanitizeIdentifier(path), operationIDs)
doc := docFor(route.Method, route.Path)
operation := map[string]any{
"tags": []string{tag},
"summary": route.Method + " " + path,
"summary": doc.Summary,
"operationId": operationID,
"responses": responsesForRoute(route),
}
if doc.Description != "" {
operation["description"] = doc.Description
}
if params := parametersForRoute(route); len(params) > 0 {
operation["parameters"] = params