Skip to main content

EOAP OpenAPI Health Check

PyPI - Version PyPI - Python Version

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 aliases ok and up) for a healthy service;
  • warn for a service that remains available but has concerns; or
  • fail (including error and down) 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.

Metadata

Release files for eoap-api-health-check 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eoap-api-health-check 0.4.0
File Size Uploaded
eoap_api_health_check-0.4.0.tar.gz 103.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eoap-api-health-check 0.4.0
File Interpreter ABI Platform
eoap_api_health_check-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 113.7 kB

Release files / eoap_api_health_check-0.4.0.tar.gz

Download URL eoap_api_health_check-0.4.0.tar.gz
Size 103.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7cbdfdf60f557d547ba0e75712cb55763884504c9a2b58e922212cd1abd62da7
BLAKE2b-256 checksum
How to use checksums
80a71a0988d2402a11dbe8a725f8bebd8e9bac105cda5ef4836bead1c0095b41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release files / eoap_api_health_check-0.4.0-py3-none-any.whl

Download URL eoap_api_health_check-0.4.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
926b36dd2457bac87ece5a68da89cc0a24ae048916d887be3591c2e4c0c3dc80
BLAKE2b-256 checksum
How to use checksums
8beccbee9af433cfb3b5ca2569162b1b70b150509840564ea02cc1ad9e2fe487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page