ashb commented on code in PR #62343:
URL: https://github.com/apache/airflow/pull/62343#discussion_r3169352729
##########
task-sdk/src/airflow/sdk/api/client.py:
##########
@@ -872,6 +874,25 @@ def get_detail_response(self, ti_id: uuid.UUID) ->
HITLDetailResponse:
return HITLDetailResponse.model_validate_json(resp.read())
+class ConnectionTestOperations:
+ __slots__ = ("client",)
+
+ def __init__(self, client: Client):
+ self.client = client
+
+ def get_connection(self, connection_test_id: uuid.UUID) ->
ConnectionResponse:
+ """Fetch connection data for a test request from the API server."""
+ resp =
self.client.get(f"connection-tests/{connection_test_id}/connection")
+ return ConnectionResponse.model_validate_json(resp.read())
Review Comment:
Return type is `ConnectionResponse` but the endpoint (`GET
/connection-tests/{id}/connection`) returns `ConnectionTestConnectionResponse`.
Both models happen to have the same fields today so it works at runtime, but
the annotation is wrong and will silently break if the two models ever diverge.
```suggestion
def get_connection(self, connection_test_id: uuid.UUID) ->
ConnectionTestConnectionResponse:
"""Fetch connection data for a test request from the API server."""
resp =
self.client.get(f"connection-tests/{connection_test_id}/connection")
return
ConnectionTestConnectionResponse.model_validate_json(resp.read())
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]