/api/openapi.json is generated from a table of endpoints and the Go types the handlers bind and return, including the limits of their binding tags, so the document follows the code. A test fails for routes missing from the table or documented but not served. /api/docs shows it with Swagger UI from our own assets, usable without internet access; "Try it out" works with the browser session. Closes #84 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
20 lines
533 B
Go
20 lines
533 B
Go
package api
|
|
|
|
// LookupTXT lets tests replace DNS lookups for domain verification.
|
|
var LookupTXT = &lookupTXT
|
|
|
|
// AuditActions exposes the audited routes to tests.
|
|
var AuditActions = auditActions
|
|
|
|
// DocumentedRoutes lists the routes in the OpenAPI table.
|
|
func DocumentedRoutes() []string {
|
|
out := make([]string, len(endpoints))
|
|
for i, e := range endpoints {
|
|
out[i] = e.method + " " + e.path
|
|
}
|
|
return out
|
|
}
|
|
|
|
// OpenAPI builds the OpenAPI document.
|
|
func OpenAPI() map[string]any { return buildOpenAPI("https://uptime.example") }
|