From e6544ff29e0c7610d44a0b78ef7c6dc9cc5cc883 Mon Sep 17 00:00:00 2001 From: mahdikhashan Date: Fri, 29 Nov 2024 15:44:31 +0100 Subject: [PATCH] wip: serve open-api.yaml from API --- pkg/api/serve.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/api/serve.go b/pkg/api/serve.go index 51fac13a3ea..1aec11f8314 100644 --- a/pkg/api/serve.go +++ b/pkg/api/serve.go @@ -63,6 +63,8 @@ func Serve(cfg *config.Config, catalog *catalog.Catalog, middlewareAuthenticator r.Mount("/metrics", promhttp.Handler()) r.Mount("/_pprof/", httputil.ServePPROF("/_pprof/")) r.Mount("/openapi.json", http.HandlerFunc(swaggerSpecHandler)) + // TODO: communicate with the team to check the design, it could be a breaking change + r.Mount("/resources/openapi.yaml", http.HandlerFunc(openAPISpecHandler)) // it seems that the above path could be also moved to under /resources as well r.Mount(apiutil.BaseURL, http.HandlerFunc(InvalidAPIEndpointHandler)) r.Mount("/logout", NewLogoutHandler(sessionStore, logger, cfg.Auth.LogoutRedirectURL)) @@ -94,6 +96,10 @@ func swaggerSpecHandler(w http.ResponseWriter, _ *http.Request) { _, _ = io.Copy(w, reader) } +func openAPISpecHandler(w http.ResponseWriter, _ *http.Request) { + // TODO: implement me +} + // OapiRequestValidatorWithOptions Creates middleware to validate request by swagger spec. // This middleware is good for net/http either since go-chi is 100% compatible with net/http. // The original implementation can be found at https://github.com/deepmap/oapi-codegen/blob/master/pkg/chi-middleware/oapi_validate.go