Skip to content

Commit

Permalink
fix: use schemas for health (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Mar 25, 2024
1 parent e79d41b commit 9ae1480
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 31 deletions.
8 changes: 7 additions & 1 deletion healthx/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ package healthx

import "strings"

// The health status of the service.
//
// swagger:model healthStatus
type swaggerHealthStatus struct {
// Status always contains "ok".
Status string `json:"status"`
}

// The not ready status of the service.
//
// swagger:model healthNotReadyStatus
type swaggerNotReadyStatus struct {
// Errors contains a list of errors that caused the not ready status.
Expand All @@ -26,7 +30,9 @@ func (s swaggerNotReadyStatus) Error() string {
return strings.Join(errs, "; ")
}

// swagger:model version
// The service's version.
//
// swagger:model serviceVersion
type swaggerVersion struct {
// Version is the service's version.
Version string `json:"version"`
Expand Down
34 changes: 4 additions & 30 deletions healthx/openapi/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
content:
application/json:
schema:
required:
- status
type: object
properties:
status:
description: Always "ok".
type: string
"$ref": "#/components/schemas/healthStatus"
description: '{{.ProjectHumanName}} is ready to accept connections.'
default:
content:
Expand Down Expand Up @@ -52,27 +46,13 @@
content:
application/json:
schema:
required:
- status
type: object
properties:
status:
description: Always "ok".
type: string
"$ref": "#/components/schemas/healthStatus"
description: '{{.ProjectHumanName}} is ready to accept requests.'
'503':
content:
application/json:
schema:
required:
- errors
properties:
errors:
additionalProperties:
type: string
description: Errors contains a list of errors that caused the not ready status.
type: object
type: object
"$ref": "#/components/schemas/healthNotReadyStatus"
description: Ory Kratos is not yet ready to accept requests.
default:
content:
Expand Down Expand Up @@ -100,13 +80,7 @@
content:
application/json:
schema:
type: object
required:
- version
properties:
version:
description: The version of {{.ProjectHumanName}}.
type: string
"$ref": "#/components/schemas/serviceVersion"
description: Returns the {{.ProjectHumanName}} version.
summary: Return Running Software Version.
tags: {{ .HealthPathTags | toJson }}

0 comments on commit 9ae1480

Please sign in to comment.