Skip to content

Commit

Permalink
wip: serve open-api.yaml from API
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdikhashan committed Nov 29, 2024
1 parent 7f58e03 commit e6544ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/api/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e6544ff

Please sign in to comment.