Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions airflow/api_fastapi/common/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,16 +536,17 @@ def _transform_dag_run_states(states: Iterable[str] | None) -> list[DagRunState

# TI
def _transform_ti_states(states: list[str] | None) -> list[TaskInstanceState | None] | None:
"""Transform a list of state strings into a list of TaskInstanceState enums handling special 'None' cases."""
if not states:
return None

try:
if not states:
return None
return [None if s in ("none", None) else TaskInstanceState(s) for s in states]
except ValueError:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=f"Invalid value for state. Valid values are {', '.join(TaskInstanceState)}",
)
return states


QueryTIStateFilter = Annotated[
Expand Down