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

docs: add health check to swagger and resolve swagger issues #488

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request, ps httprouter.Para
// oauth2: hydra.clients
//
// Responses:
// 204
// 204: emptyResponse
// 401: genericError
// 403: genericError
// 500: genericError
Expand Down
5 changes: 1 addition & 4 deletions cmd/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ func (h *Handler) registerRoutes(router *httprouter.Router) {
Manager: ctx.GroupManager,
}
h.Groups.SetRoutes(router)

router.GET("/health", func(rw http.ResponseWriter, r *http.Request, _ httprouter.Params) {
rw.WriteHeader(http.StatusNoContent)
})
_ = newHealthHandler(c, router)

// Create root account if new install
createRS256KeysIfNotExist(c, oauth2.ConsentEndpointKey, "private", "sig")
Expand Down
13 changes: 13 additions & 0 deletions cmd/server/handler_health_factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package server

import (
"github.com/julienschmidt/httprouter"
"github.com/ory/hydra/config"
"github.com/ory/hydra/health"
)

func newHealthHandler(c *config.Config, router *httprouter.Router) *health.Handler {
h := &health.Handler{}
h.SetRoutes(router)
return h
}
17 changes: 15 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,26 @@
// type: oauth2
// authorizationUrl: /oauth2/auth
// tokenUrl: /oauth2/token
// in: header
// flow: accessCode
//
// Extensions:
// ---
// x-request-id: string
// x-forwarded-proto: string
// ---
//
// swagger:meta
package main


// scopes:
// hydra.clients: "A scope required to manage OAuth 2.0 Clients"
// hydra.policies: "A scope required to manage access control policies"
// hydra.groups: "A scope required to manage warden groups"
// hydra.warden: "A scope required to make access control inquiries"
// hydra.keys.get: "A scope required to fetch JSON Web Keys"
// hydra.keys.create: "A scope required to create JSON Web Keys"
// hydra.keys.delete: "A scope required to delete JSON Web Keys"
// hydra.keys.update: "A scope required to get JSON Web Keys"
// offline: "A scope required when requesting refresh tokens"
// openid: "Request an OpenID Connect ID Token"
//
6 changes: 6 additions & 0 deletions doc_swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ type genericError struct {
Message string `json:"message"`
}
}

// The standard error format
// swagger:response emptyResponse
type emptyResponse struct {
Description string `json:"description,omitempty"`
}
Loading