pierrejeambrun commented on code in PR #47440:
URL: https://github.com/apache/airflow/pull/47440#discussion_r2020608835


##########
airflow-core/src/airflow/api_fastapi/common/parameters.py:
##########
@@ -221,9 +246,13 @@ def get_primary_key_string(self) -> str:
     def depends(cls, *args: Any, **kwargs: Any) -> Self:
         raise NotImplementedError("Use dynamic_depends, depends not 
implemented.")
 
-    def dynamic_depends(self, default: str | None = None) -> Callable:
-        def inner(order_by: str = default or self.get_primary_key_string()) -> 
SortParam:
-            return self.set_value(self.get_primary_key_string() if order_by == 
"" else order_by)
+    def dynamic_depends(self, default: list[str] | None = None) -> Callable:
+        def inner(order_by: list[str] | str | None = Query(default)) -> 
SortParam:
+            if order_by is None:
+                order_by = [self.get_primary_key_string()]
+            elif isinstance(order_by, str):
+                order_by = [order_by]
+            return self.set_value(order_by)

Review Comment:
   I'm not sure it's exactly equivalent. If there is no `order_by` query param 
specified, we shouldn't add any by default and let the query default order 
operate:
   - order_by = None => don't update the query at all and let the default 
ordering of the query operate.
   - order_by = [] or [""] -> fill with [primary_key_string] (or raise 
validation error)



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