feat: expose runtime OpenAPI contract
Register typed API operations and serve an always-current OpenAPI document without a generation command or committed generated artifact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
314c783659
commit
045f0b7cf2
9 changed files with 533 additions and 76 deletions
|
|
@ -20,6 +20,10 @@ var safeSchemaRegex = regexp.MustCompile(`^[a-zA-Z0-9_:-]+$`)
|
|||
func TenantSchemaMiddleware(db *gorm.DB) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/api/health" || r.URL.Path == "/api/openapi.json" {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
tenantID := r.Header.Get("X-Tenant-Id")
|
||||
if tenantID == "" {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue