prabhusneha commented on code in PR #45420:
URL: https://github.com/apache/airflow/pull/45420#discussion_r1921610722


##########
airflow/api_fastapi/common/parameters.py:
##########
@@ -324,21 +328,34 @@ def depends_filter(value: T | None = query) -> 
FilterParam[T | None]:
     return depends_filter
 
 
-class _TagsFilter(BaseParam[list[str]]):
+class _TagFilterModel(BaseModel):
+    """Tag Filter Model with a match mode parameter."""
+
+    tags: list[str]
+    tags_match_mode: str | None
+
+
+class _TagsFilter(BaseParam[_TagFilterModel]):
     """Filter on tags."""
 
     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)}")
 
-        if not self.value:
+        if not self.value or not self.value.tags:
             return select
 
-        conditions = [DagModel.tags.any(DagTag.name == tag) for tag in 
self.value]
-        return select.where(or_(*conditions))
+        if not self.value.tags_match_mode or self.value.tags_match_mode == 
"any":
+            conditions = [DagModel.tags.any(DagTag.name == tag) for tag in 
self.value.tags]
+            return select.where(or_(*conditions))
+        else:
+            conditions = [DagModel.tags.any(DagTag.name == tag) for tag in 
self.value.tags]
+            return select.where(and_(*conditions))
 
-    def depends(self, tags: list[str] = Query(default_factory=list)) -> 
_TagsFilter:
-        return self.set_value(tags)
+    def depends(
+        self, tags: list[str] = Query(default_factory=list), tags_match_mode: 
str | None = Query(default=None)
+    ) -> _TagsFilter:

Review Comment:
   Changed to literal



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