pierrejeambrun commented on code in PR #42782: URL: https://github.com/apache/airflow/pull/42782#discussion_r1794908126
########## airflow/api_fastapi/openapi/v1-generated.yaml: ########## @@ -155,7 +155,7 @@ paths: required: false schema: type: string - default: dag_id + default: '' Review Comment: We lost the default here because the value is now dinamically set at runtime by inspecting the model ########## airflow/api_fastapi/serializers/connections.py: ########## @@ -27,7 +27,7 @@ class ConnectionResponse(BaseModel): """Connection serializer for responses.""" - connection_id: str = Field(alias="conn_id") + connection_id: str = Field(serialization_alias="connection_id", validation_alias="conn_id") Review Comment: Nice. ########## airflow/api_fastapi/parameters.py: ########## @@ -148,17 +150,29 @@ def depends(self, dag_display_name_pattern: str | None = None) -> _DagDisplayNam return self.set_value(dag_display_name_pattern) +# SortParam Implementations class SortParam(BaseParam[str]): """Order result by the attribute.""" attr_mapping = { "last_run_state": DagRun.state, "last_run_start_date": DagRun.start_date, + "connection_id": Connection.conn_id, + "conn_type": Connection.conn_type, + "description": Connection.description, + "host": Connection.host, + "port": Connection.port, + "id": Connection.id, Review Comment: Most of them you don't need. Thinks will fallback to the `self.model.column` automatically. ``` getattr( self.model, lstriped_orderby ) ``` Whe only need to use the `mapping` if the attribute is on a related / joined table, and not the default `Model` one. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org