Skip to content

Commit

Permalink
Remove None from param definition, adjust the log of wrong DagRun typ…
Browse files Browse the repository at this point in the history
…e in parameters and test
  • Loading branch information
bugraoz93 committed Dec 23, 2024
1 parent f3908ee commit f957ac4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
6 changes: 3 additions & 3 deletions airflow/api_fastapi/common/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def _transform_dag_run_types(types: list[str] | None) -> list[DagRunType | None]
except ValueError:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=f"Invalid value for state. Valid values are {', '.join(DagRunType)}",
detail=f"Invalid value for run type. Valid values are {', '.join(DagRunType)}",
)


Expand Down Expand Up @@ -635,8 +635,8 @@ def _optional_boolean(value: bool | None) -> bool | None:
return value if value is not None else False


QueryIncludeUpstream = Annotated[Union[bool, None], AfterValidator(_optional_boolean)]
QueryIncludeDownstream = Annotated[Union[bool, None], AfterValidator(_optional_boolean)]
QueryIncludeUpstream = Annotated[Union[bool], AfterValidator(_optional_boolean)]
QueryIncludeDownstream = Annotated[Union[bool], AfterValidator(_optional_boolean)]

state_priority: list[None | TaskInstanceState] = [
TaskInstanceState.FAILED,
Expand Down
16 changes: 4 additions & 12 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,14 @@ paths:
in: query
required: false
schema:
anyOf:
- type: boolean
- type: 'null'
type: boolean
default: false
title: Include Upstream
- name: include_downstream
in: query
required: false
schema:
anyOf:
- type: boolean
- type: 'null'
type: boolean
default: false
title: Include Downstream
- name: root
Expand Down Expand Up @@ -353,18 +349,14 @@ paths:
in: query
required: false
schema:
anyOf:
- type: boolean
- type: 'null'
type: boolean
default: false
title: Include Upstream
- name: include_downstream
in: query
required: false
schema:
anyOf:
- type: boolean
- type: 'null'
type: boolean
default: false
title: Include Downstream
- name: logical_date_gte
Expand Down
8 changes: 4 additions & 4 deletions airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1509,8 +1509,8 @@ export type HistoricalMetricsResponse = HistoricalMetricDataResponse;
export type StructureDataData = {
dagId: string;
externalDependencies?: boolean;
includeDownstream?: boolean | null;
includeUpstream?: boolean | null;
includeDownstream?: boolean;
includeUpstream?: boolean;
root?: string | null;
};

Expand Down Expand Up @@ -1567,8 +1567,8 @@ export type CancelBackfillResponse = BackfillResponse;

export type GridDataData = {
dagId: string;
includeDownstream?: boolean | null;
includeUpstream?: boolean | null;
includeDownstream?: boolean;
includeUpstream?: boolean;
limit?: number;
logicalDateGte?: string | null;
logicalDateLte?: string | null;
Expand Down
2 changes: 1 addition & 1 deletion tests/api_fastapi/core_api/routes/ui/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2799,7 +2799,7 @@ def test_should_response_200_run_types(self, test_client, run_type, expected):
[
(
["invalid"],
{"detail": f"Invalid value for state. Valid values are {', '.join(DagRunType)}"},
{"detail": f"Invalid value for run type. Valid values are {', '.join(DagRunType)}"},
)
],
)
Expand Down

0 comments on commit f957ac4

Please sign in to comment.