health-schema-status-in-required
Requires the /health success response schema to list status as required.
| Attribute | Value |
|---|---|
| Category | Schema |
| Maturity | Gold |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Off |
| Lenient–Strict | Warning |
| Complete | Error |
Intent
A health response without a status cannot communicate the service's aggregate state, so clients should be able to rely on its presence.
Flags
The first 2xx response schema of the first GET path ending in /health when its required array does not contain status.
Does not flag
Other paths, health endpoints without a 2xx content schema, or schemas that require status. Property declaration is checked separately by health-schema-status.
See it fail
schema:
type: object
properties:
status:
type: string
status exists but remains optional.
Fix it
schema:
type: object
required: [status]
properties:
status:
type: string
Configure
profiles:
default:
rules:
extends: [recommended]
override:
health-schema-status-in-required: error
Nearby: health-schema-status, health-info-schema-status-in-required.