Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(sdk): type readiness details as always present
Yudhi Armyndharis8b554c6f086d
diff --git a/sdk/go/health_ready_test.go b/sdk/go/health_ready_test.gonew file mode 100644index 000000000..876828934--- /dev/null+++ b/sdk/go/health_ready_test.go@@ -0,0 +1,18 @@+package openwa++import (+ "encoding/json"+ "strings"+ "testing"+)++// The server always sends details on /health/ready, so the field is not optional.+func TestHealthReadyResponseDetailsIsRequired(t *testing.T) {+ b, err := json.Marshal(HealthReadyResponse{Status: "ok"})+ if err != nil {+ t.Fatal(err)+ }+ if !strings.Contains(string(b), `"details"`) {+ t.Errorf("marshalled %s, want a details key", b)+ }+}diff --git a/sdk/go/types_misc.go b/sdk/go/types_misc.goindex e7c2313d4..24e05df8c 100644--- a/sdk/go/types_misc.go+++ b/sdk/go/types_misc.go@@ -19,7 +19,7 @@ type DependencyStatus struct {// name (e.g. "mainDatabase", "dataDatabase") to its DependencyStatus.type HealthReadyResponse struct {Status string `json:"status"`- Details map[string]DependencyStatus `json:"details,omitempty"`+ Details map[string]DependencyStatus `json:"details"`}// ── Auth ─────────────────────────────────────────────────diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.pyindex 0781b206c..97f25640c 100644--- a/sdk/python/openwa/types.py+++ b/sdk/python/openwa/types.py@@ -1235,7 +1235,7 @@ class HealthDependencyStatus(TypedDict):status: str-class HealthReadyResponse(TypedDict, total=False):+class HealthReadyResponse(TypedDict):status: strdetails: dict[str, HealthDependencyStatus]diff --git a/sdk/python/tests/test_sdk.py b/sdk/python/tests/test_sdk.pyindex fbc151e5e..cad05284e 100644--- a/sdk/python/tests/test_sdk.py+++ b/sdk/python/tests/test_sdk.py@@ -15,6 +15,7 @@ from openwa.errors import OpenWAServiceUnavailableErrorfrom openwa.resources.messages import MessagesResourcefrom openwa.types import (BatchCancelResponse,+ HealthReadyResponse,WebhookDelivery,WebhookDeliveryEvent,WebhookEvent,@@ -884,6 +885,10 @@ class TestChatsAndHealth:assert backend.calls[-1].method == "POST"assert "/auth/validate" in backend.calls[-1].url+ def test_health_ready_response_requires_details(self):+ # The readiness route always sends details, on the 200 and on the 503.+ assert HealthReadyResponse.__required_keys__ == frozenset({"status", "details"})+class TestLabelsChannelsCatalog:def test_labels(self):