prasad-madine commented on code in PR #47440:
URL: https://github.com/apache/airflow/pull/47440#discussion_r1984972239


##########
airflow/api_fastapi/common/parameters.py:
##########
@@ -164,6 +164,7 @@ def depends_search(value: str | None = 
Query(alias=pattern_name, default=None))
 
 class SortParam(BaseParam[str]):
     """Order result by the attribute."""
+    MAX_SORT_PARAMS = 2

Review Comment:
   fixed



##########
airflow/api_fastapi/common/parameters.py:
##########
@@ -173,14 +174,31 @@ def __init__(
         self.model = model
         self.to_replace = to_replace
 
-    def to_orm(self, select: Select) -> Select:
-        if self.skip_none is False:
-            raise ValueError(f"Cannot set 'skip_none' to False on a 
{type(self)}")
+    def get_order_by_columns(self, order_by_list: list[str]) -> list:
+        """Generates order_by conditions based on the given sorting 
parameters."""
+        if len(order_by_list) > MAX_SORT_PARAMS:
+            raise HTTPException(
+                400, 
+                f"Ordering with more than two parameters is not allowed. 
Provided: {order_by_list}"

Review Comment:
   fixed



-- 
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]

Reply via email to