Skip to content

Commit 04deed5

Browse files
authored
fix: add /healthz to root link list (#804)
This adds `/healthz` the the root link list
1 parent 602ca4e commit 04deed5

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

api/docs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5153,6 +5153,11 @@ const docTemplate = `{
51535153
"type": "string",
51545154
"example": "https://example.com/api/docs/index.html"
51555155
},
5156+
"healthz": {
5157+
"description": "Healthz endpoint",
5158+
"type": "string",
5159+
"example": "https://example.com/api/healtzh"
5160+
},
51565161
"v1": {
51575162
"description": "List endpoint for all v1 endpoints",
51585163
"type": "string",

api/swagger.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5142,6 +5142,11 @@
51425142
"type": "string",
51435143
"example": "https://example.com/api/docs/index.html"
51445144
},
5145+
"healthz": {
5146+
"description": "Healthz endpoint",
5147+
"type": "string",
5148+
"example": "https://example.com/api/healtzh"
5149+
},
51455150
"v1": {
51465151
"description": "List endpoint for all v1 endpoints",
51475152
"type": "string",

api/swagger.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,10 @@ definitions:
11381138
description: Swagger API documentation
11391139
example: https://example.com/api/docs/index.html
11401140
type: string
1141+
healthz:
1142+
description: Healthz endpoint
1143+
example: https://example.com/api/healtzh
1144+
type: string
11411145
v1:
11421146
description: List endpoint for all v1 endpoints
11431147
example: https://example.com/api/v1

pkg/router/router.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ type RootResponse struct {
146146

147147
type RootLinks struct {
148148
Docs string `json:"docs" example:"https://example.com/api/docs/index.html"` // Swagger API documentation
149+
Healthz string `json:"healthz" example:"https://example.com/api/healtzh"` // Healthz endpoint
149150
Version string `json:"version" example:"https://example.com/api/version"` // Endpoint returning the version of the backend
150151
V1 string `json:"v1" example:"https://example.com/api/v1"` // List endpoint for all v1 endpoints
151152
V2 string `json:"v2" example:"https://example.com/api/v2"` // List endpoint for all v2 endpoints
@@ -162,6 +163,7 @@ func GetRoot(c *gin.Context) {
162163
c.JSON(http.StatusOK, RootResponse{
163164
Links: RootLinks{
164165
Docs: c.GetString(string(database.ContextURL)) + "/docs/index.html",
166+
Healthz: c.GetString(string(database.ContextURL)) + "/healthz",
165167
Version: c.GetString(string(database.ContextURL)) + "/version",
166168
V1: c.GetString(string(database.ContextURL)) + "/v1",
167169
V2: c.GetString(string(database.ContextURL)) + "/v2",

pkg/router/router_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func TestGetRoot(t *testing.T) {
8888
l := router.RootResponse{
8989
Links: router.RootLinks{
9090
Docs: "/docs/index.html",
91+
Healthz: "/healthz",
9192
Version: "/version",
9293
V1: "/v1",
9394
V2: "/v2",

0 commit comments

Comments
 (0)