jason810496 commented on code in PR #42959:
URL: https://github.com/apache/airflow/pull/42959#discussion_r1799858815


##########
airflow/api_fastapi/views/public/dags.py:
##########
@@ -92,6 +93,28 @@ async def get_dags(
     )
 
 
+@dags_router.get(
+    "/tags",
+    response_model=list[DAGTagResponse],
+    responses=create_openapi_http_exception_doc([400, 401, 403]),
+)
+async def get_dag_tags(
+    tags: QueryTagsFilter,
+    session: Annotated[Session, Depends(get_session)],
+) -> list[DAGTagResponse]:
+    """Get all DAG tags."""
+    dag_tag_names = 
session.query(distinct(DagTag.name)).order_by(DagTag.name).all()
+    if not dag_tag_names:
+        return []
+    selected_dag_tags = {}
+    if tags.value:
+        selected_dag_tags = {tag: True for tag in tags.value}
+    return [
+        DAGTagResponse(name=tag_name_row[0], 
selected=selected_dag_tags.get(tag_name_row[0], False))
+        for tag_name_row in dag_tag_names

Review Comment:
   However, I believe this can be handled on the frontend (by storing the 
user’s selected state there, instead of passing tags through the API to get the 
`selected` fields). It’s not necessary to migrate the `selected` logic from the 
legacy API.



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