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

fix: use schemas for health #774

Merged
merged 1 commit into from
Mar 25, 2024
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
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 }}
Loading