Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(sdk): type Python readiness dependencies as status objects

Yudhi Armyndharisc1cc365cbf5b
diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.py
index 47d4ac4e5..da1fa33fd 100644
--- a/sdk/python/openwa/types.py
+++ b/sdk/python/openwa/types.py
@@ -1212,9 +1212,13 @@ class HealthResponse(TypedDict, total=False):
version: str
+class HealthDependencyStatus(TypedDict):
+ status: str
+
+
class HealthReadyResponse(TypedDict, total=False):
status: str
- details: dict[str, str]
+ details: dict[str, HealthDependencyStatus]
# ── Auth ──────────────────────────────────────────────────────────
diff --git a/sdk/python/tests/test_sdk.py b/sdk/python/tests/test_sdk.py
index 87c1d2b84..285459a34 100644
--- a/sdk/python/tests/test_sdk.py
+++ b/sdk/python/tests/test_sdk.py
@@ -834,13 +834,15 @@ class TestChatsAndHealth:
backend = MockBackend()
backend.on("GET", "/api/health", body={"status": "ok", "version": "0.7.2"})
backend.on("GET", "/live", body={"status": "ok"})
- backend.on("GET", "/ready", body={"status": "ok", "details": {}})
+ # The full path, so it outranks the shorter /api/health prefix it contains.
+ ready = {"status": "ok", "details": {"mainDatabase": {"status": "up"}, "dataDatabase": {"status": "up"}}}
+ backend.on("GET", "/api/health/ready", body=ready)
backend.on("POST", "/validate", body={"valid": True, "role": "admin"})
client = make_client(backend)
client.health.check()
assert backend.calls[-1].url == "http://localhost:2785/api/health"
client.health.live()
- client.health.ready()
+ assert client.health.ready()["details"]["mainDatabase"]["status"] == "up"
client.auth()
assert backend.calls[-1].method == "POST"
assert "/auth/validate" in backend.calls[-1].url