pierrejeambrun commented on code in PR #68854:
URL: https://github.com/apache/airflow/pull/68854#discussion_r3873453513
##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -659,6 +660,14 @@ def update(self, pool_body: PoolPatchBody) -> PoolResponse
| ServerResponseError
class ProvidersOperations(BaseOperations):
"""Provider operations."""
+ def get(self, provider_name: str) -> ProviderDetailsResponse |
ServerResponseError:
+ """Get detailed information for a provider."""
+ try:
+ self.response = self.client.get(f"providers/{provider_name}")
+ return
ProviderDetailsResponse.model_validate_json(self.response.content)
+ except ServerResponseError as e:
+ raise e
+
Review Comment:
this catch re-raise is weird.
##########
airflow-core/src/airflow/api_fastapi/core_api/services/public/providers.py:
##########
@@ -33,3 +33,13 @@ def _provider_mapper(provider: ProviderInfo) ->
ProviderResponse:
version=provider.version,
documentation_url=provider.data["documentation-url"],
)
+
+
+def map_provider_details(provider: ProviderInfo) -> ProviderDetailsResponse:
+ """Map provider information to a detailed API response."""
+ provider_info = dict(provider.data)
+ provider_info["description"] =
_remove_rst_syntax(provider_info["description"])
+ return ProviderDetailsResponse(
+ **_provider_mapper(provider).model_dump(),
+ provider_info=provider_info,
+ )
Review Comment:
Should we still control what keys are serialized instead of serializing
everything? Just as a defensive mechanism. Also this would be helpful because
this would add types in the api spec instead of a 'dict'
##########
airflow-core/src/airflow/api_fastapi/core_api/services/public/providers.py:
##########
@@ -33,3 +33,13 @@ def _provider_mapper(provider: ProviderInfo) ->
ProviderResponse:
version=provider.version,
documentation_url=provider.data["documentation-url"],
)
+
+
+def map_provider_details(provider: ProviderInfo) -> ProviderDetailsResponse:
+ """Map provider information to a detailed API response."""
+ provider_info = dict(provider.data)
+ provider_info["description"] =
_remove_rst_syntax(provider_info["description"])
+ return ProviderDetailsResponse(
+ **_provider_mapper(provider).model_dump(),
+ provider_info=provider_info,
+ )
Review Comment:
We have information of that schema from `provider_info.schema.json` I
believe.
--
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]