Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serve open-api.yaml from API #8404

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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