EOAP HTTP API Health Check
Project description
EOAP OpenAPI Health Check
EOAP OpenAPI Health Check provides a shared contract for reporting the health of
EOAP services and their dependencies. The contract follows the
application/health+json Internet-Draft
and exposes it as an OpenAPI 3.1 definition for a conventional GET /health
endpoint.
The OpenAPI definition is the source of truth. It is used to generate:
- Pydantic models, published on PyPI as
eoap-api-health-check; - a rendered OpenAPI reference for the project documentation; and
- a reusable API contract for services and tooling in any language.
What the contract describes
A health response has one of three outcomes:
pass(including the compatible aliasesokandup) for a healthy service;warnfor a service that remains available but has concerns; orfail(includingerroranddown) for an unhealthy service.
Responses can include service metadata, diagnostic notes, links, and checks grouped by dependency or sub-component. Each check can report an observed value, its unit, the observation time, affected endpoints, and diagnostic output.
See the project documentation for the design and usage overview, or inspect the OpenAPI source for the complete contract.
Install the Python models
pip install eoap-api-health-check
The generated models can be used to construct and validate health payloads:
from eoap_api_health_check import ComponentHealth, HealthyResponse, HealthyStatus
health = HealthyResponse(
status=HealthyStatus.PASS,
version="1.0.0",
checks={
"database:responseTime": [
ComponentHealth(
componentType="datastore",
observedValue=42,
observedUnit="ms",
status=HealthyStatus.PASS,
)
]
},
)
payload = health.model_dump(by_alias=True, mode="json", exclude_none=True)
Property names in Python use snake_case; passing aliases such as
componentType is also supported. Serializing with by_alias=True produces
the camel-cased names defined by the wire format.
FastAPI integration
Since version 0.3.0, an optional FastAPI extension provides the
HealthJSONResponse convenience response. Install it with:
pip install "eoap-api-health-check[fastapi]"
Use the response in a route to serialize a health model as
application/health+json and add a default Cache-Control: max-age=60 header:
from fastapi import FastAPI
from eoap_api_health_check import HealthyResponse
from eoap_api_health_check.fastapi import HealthJSONResponse
app = FastAPI()
@app.get("/health", response_class=HealthJSONResponse)
def health() -> HealthJSONResponse:
return HealthJSONResponse(
HealthyResponse(
status="pass",
version="1.0.0",
service_id="catalogue-api",
)
)
Pass status_code or cache_control to customize the HTTP response. Set
cache_control=None to omit the cache header.
Development
Do not edit src/eoap_api_health_check/__init__.py directly: it is regenerated
from schemas/openapi.yaml.
With Task installed, run the complete generation and validation workflow with:
task
Useful focused tasks are:
task process_schema # regenerate the Pydantic models
task generate_openapi_docs # refresh the documentation artifacts
task serve_docs # build and serve the documentation locally
License
This project is licensed under the Apache License 2.0.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eoap_api_health_check-0.4.0.tar.gz.
File metadata
- Download URL: eoap_api_health_check-0.4.0.tar.gz
- Upload date:
- Size: 103.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cbdfdf60f557d547ba0e75712cb55763884504c9a2b58e922212cd1abd62da7
|
|
| MD5 |
c69c57ad5d941123270c3a026a2cbdaf
|
|
| BLAKE2b-256 |
80a71a0988d2402a11dbe8a725f8bebd8e9bac105cda5ef4836bead1c0095b41
|
Provenance
The following attestation bundles were made for eoap_api_health_check-0.4.0.tar.gz:
Publisher:
package.yaml on Terradue/api-health-check
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eoap_api_health_check-0.4.0.tar.gz -
Subject digest:
7cbdfdf60f557d547ba0e75712cb55763884504c9a2b58e922212cd1abd62da7 - Sigstore transparency entry: 2303388493
- Sigstore integration time:
-
Permalink:
Terradue/api-health-check@d2e13cd0e7227c9732cc88b65830600624780e86 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Terradue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yaml@d2e13cd0e7227c9732cc88b65830600624780e86 -
Trigger Event:
push
-
Statement type:
File details
Details for the file eoap_api_health_check-0.4.0-py3-none-any.whl.
File metadata
- Download URL: eoap_api_health_check-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
926b36dd2457bac87ece5a68da89cc0a24ae048916d887be3591c2e4c0c3dc80
|
|
| MD5 |
1bc1a2b7e27e280c60ad3f93050854f1
|
|
| BLAKE2b-256 |
8beccbee9af433cfb3b5ca2569162b1b70b150509840564ea02cc1ad9e2fe487
|
Provenance
The following attestation bundles were made for eoap_api_health_check-0.4.0-py3-none-any.whl:
Publisher:
package.yaml on Terradue/api-health-check
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eoap_api_health_check-0.4.0-py3-none-any.whl -
Subject digest:
926b36dd2457bac87ece5a68da89cc0a24ae048916d887be3591c2e4c0c3dc80 - Sigstore transparency entry: 2303388515
- Sigstore integration time:
-
Permalink:
Terradue/api-health-check@d2e13cd0e7227c9732cc88b65830600624780e86 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Terradue
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yaml@d2e13cd0e7227c9732cc88b65830600624780e86 -
Trigger Event:
push
-
Statement type: