You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bu...@apache.org on 2025/04/15 20:04:28 UTC
(airflow) branch main updated: feat (api-airflowctl): Change ExtraLinksResponse to BaseModel (#49250)
This is an automated email from the ASF dual-hosted git repository.
bugraoz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 0b3bee770d8 feat (api-airflowctl): Change ExtraLinksResponse to BaseModel (#49250)
0b3bee770d8 is described below
commit 0b3bee770d877d9a6d22f46b7668e563c58028c9
Author: Bugra Ozturk <bu...@users.noreply.github.com>
AuthorDate: Tue Apr 15 22:04:21 2025 +0200
feat (api-airflowctl): Change ExtraLinksResponse to BaseModel (#49250)
* Change ExtraLinksResponse to BaseModel and generate latest datamodels for airflowctl
* Update datamodel name to ExtraLinkCollectionResponse
---
.../api_fastapi/core_api/datamodels/extra_links.py | 11 +++-
.../core_api/openapi/v1-rest-api-generated.yaml | 24 +++++---
.../core_api/routes/public/extra_links.py | 10 +++-
.../airflow/serialization/serialized_objects.py | 2 +-
.../ui/openapi-gen/queries/ensureQueryData.ts | 4 +-
.../src/airflow/ui/openapi-gen/queries/prefetch.ts | 4 +-
.../src/airflow/ui/openapi-gen/queries/queries.ts | 4 +-
.../src/airflow/ui/openapi-gen/queries/suspense.ts | 4 +-
.../airflow/ui/openapi-gen/requests/schemas.gen.ts | 31 +++++++----
.../ui/openapi-gen/requests/services.gen.ts | 4 +-
.../airflow/ui/openapi-gen/requests/types.gen.ts | 11 ++--
.../ui/src/pages/TaskInstance/ExtraLinks.tsx | 4 +-
.../core_api/routes/public/test_extra_links.py | 64 ++++++++++++++++------
.../src/airflowctl/api/datamodels/generated.py | 32 ++++++-----
.../tests/airflow_ctl/api/__init__.py | 9 ---
.../tests/airflow_ctl/api/test_operations.py | 4 +-
pyproject.toml | 5 ++
17 files changed, 146 insertions(+), 81 deletions(-)
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py
index 1e86c5a4bc2..c13ce75f607 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py
@@ -16,10 +16,15 @@
# under the License.
from __future__ import annotations
-from pydantic import RootModel
+from typing import Annotated
+from pydantic import Field
-class ExtraLinksResponse(RootModel):
+from airflow.api_fastapi.core_api.base import BaseModel
+
+
+class ExtraLinkCollectionResponse(BaseModel):
"""Extra Links Response."""
- root: dict[str, str | None]
+ extra_links: dict[str, str | None]
+ total_entries: Annotated[int, Field(title="Total Entries")]
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml
index cdf085c51bd..dce59cbefa2 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml
+++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-rest-api-generated.yaml
@@ -3353,7 +3353,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/ExtraLinksResponse'
+ $ref: '#/components/schemas/ExtraLinkCollectionResponse'
'401':
content:
application/json:
@@ -8762,13 +8762,23 @@ components:
- extra
title: EventLogResponse
description: Event Log Response.
- ExtraLinksResponse:
- additionalProperties:
- anyOf:
- - type: string
- - type: 'null'
+ ExtraLinkCollectionResponse:
+ properties:
+ extra_links:
+ additionalProperties:
+ anyOf:
+ - type: string
+ - type: 'null'
+ type: object
+ title: Extra Links
+ total_entries:
+ type: integer
+ title: Total Entries
type: object
- title: ExtraLinksResponse
+ required:
+ - extra_links
+ - total_entries
+ title: ExtraLinkCollectionResponse
description: Extra Links Response.
FastAPIAppResponse:
properties:
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py
index a52bcef26fe..867bd8033fc 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py
@@ -24,7 +24,7 @@ from sqlalchemy.sql import select
from airflow.api_fastapi.common.db.common import SessionDep
from airflow.api_fastapi.common.router import AirflowRouter
-from airflow.api_fastapi.core_api.datamodels.extra_links import ExtraLinksResponse
+from airflow.api_fastapi.core_api.datamodels.extra_links import ExtraLinkCollectionResponse
from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc
from airflow.api_fastapi.core_api.security import DagAccessEntity, requires_access_dag
from airflow.exceptions import TaskNotFound
@@ -51,7 +51,7 @@ def get_extra_links(
session: SessionDep,
request: Request,
map_index: int = -1,
-) -> ExtraLinksResponse:
+) -> ExtraLinkCollectionResponse:
"""Get extra links for task instance."""
from airflow.models.taskinstance import TaskInstance
@@ -83,4 +83,8 @@ def get_extra_links(
(link_name, task.get_extra_links(ti, link_name)) for link_name in task.extra_links
)
all_extra_links = {link_name: link_url or None for link_name, link_url in sorted(all_extra_link_pairs)}
- return ExtraLinksResponse.model_validate(all_extra_links)
+
+ return ExtraLinkCollectionResponse(
+ extra_links=all_extra_links,
+ total_entries=len(all_extra_links),
+ )
diff --git a/airflow-core/src/airflow/serialization/serialized_objects.py b/airflow-core/src/airflow/serialization/serialized_objects.py
index 1f425c4facb..9d1dfc93e9d 100644
--- a/airflow-core/src/airflow/serialization/serialized_objects.py
+++ b/airflow-core/src/airflow/serialization/serialized_objects.py
@@ -1221,7 +1221,7 @@ class SerializedBaseOperator(BaseOperator, BaseSerialization):
:raise ValueError: The error message of a ValueError will be passed on through to
the fronted to show up as a tooltip on the disabled link.
:param ti: The TaskInstance for the URL being searched for.
- :param link_name: The name of the link we're looking for the URL for. Should be
+ :param name: The name of the link we're looking for the URL for. Should be
one of the options specified in ``extra_links``.
"""
link = self.operator_extra_link_dict.get(name) or self.global_operator_extra_link_dict.get(name)
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
index f9aafe473e7..cd06c2bff30 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
@@ -1041,7 +1041,7 @@ export const ensureUseEventLogServiceGetEventLogsData = (
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const ensureUseExtraLinksServiceGetExtraLinksData = (
@@ -1070,7 +1070,7 @@ export const ensureUseExtraLinksServiceGetExtraLinksData = (
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const ensureUseTaskInstanceServiceGetExtraLinksData = (
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
index 35328d83bb9..14649a703b1 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
@@ -1041,7 +1041,7 @@ export const prefetchUseEventLogServiceGetEventLogs = (
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const prefetchUseExtraLinksServiceGetExtraLinks = (
@@ -1070,7 +1070,7 @@ export const prefetchUseExtraLinksServiceGetExtraLinks = (
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const prefetchUseTaskInstanceServiceGetExtraLinks = (
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
index 6b5309b7233..ae20d5e3d76 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
@@ -1278,7 +1278,7 @@ export const useEventLogServiceGetEventLogs = <
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const useExtraLinksServiceGetExtraLinks = <
@@ -1313,7 +1313,7 @@ export const useExtraLinksServiceGetExtraLinks = <
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const useTaskInstanceServiceGetExtraLinks = <
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
index b4452a4722c..0bb328cbb24 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
@@ -1255,7 +1255,7 @@ export const useEventLogServiceGetEventLogsSuspense = <
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const useExtraLinksServiceGetExtraLinksSuspense = <
@@ -1290,7 +1290,7 @@ export const useExtraLinksServiceGetExtraLinksSuspense = <
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
export const useTaskInstanceServiceGetExtraLinksSuspense = <
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 1734959bf69..226a2701ba6 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -3022,19 +3022,30 @@ export const $EventLogResponse = {
description: "Event Log Response.",
} as const;
-export const $ExtraLinksResponse = {
- additionalProperties: {
- anyOf: [
- {
- type: "string",
- },
- {
- type: "null",
+export const $ExtraLinkCollectionResponse = {
+ properties: {
+ extra_links: {
+ additionalProperties: {
+ anyOf: [
+ {
+ type: "string",
+ },
+ {
+ type: "null",
+ },
+ ],
},
- ],
+ type: "object",
+ title: "Extra Links",
+ },
+ total_entries: {
+ type: "integer",
+ title: "Total Entries",
+ },
},
type: "object",
- title: "ExtraLinksResponse",
+ required: ["extra_links", "total_entries"],
+ title: "ExtraLinkCollectionResponse",
description: "Extra Links Response.",
} as const;
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
index 05ea47fa095..385f8256e7f 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
@@ -1821,7 +1821,7 @@ export class ExtraLinksService {
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
public static getExtraLinks(data: GetExtraLinksData): CancelablePromise<GetExtraLinksResponse> {
@@ -1855,7 +1855,7 @@ export class TaskInstanceService {
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
- * @returns ExtraLinksResponse Successful Response
+ * @returns ExtraLinkCollectionResponse Successful Response
* @throws ApiError
*/
public static getExtraLinks(data: GetExtraLinksData): CancelablePromise<GetExtraLinksResponse> {
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
index cf626908537..bb07b80843e 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -793,8 +793,11 @@ export type EventLogResponse = {
/**
* Extra Links Response.
*/
-export type ExtraLinksResponse = {
- [key: string]: string | null;
+export type ExtraLinkCollectionResponse = {
+ extra_links: {
+ [key: string]: string | null;
+ };
+ total_entries: number;
};
/**
@@ -2166,7 +2169,7 @@ export type GetExtraLinksData = {
taskId: string;
};
-export type GetExtraLinksResponse = ExtraLinksResponse;
+export type GetExtraLinksResponse = ExtraLinkCollectionResponse;
export type GetTaskInstanceData = {
dagId: string;
@@ -4126,7 +4129,7 @@ export type $OpenApiTs = {
/**
* Successful Response
*/
- 200: ExtraLinksResponse;
+ 200: ExtraLinkCollectionResponse;
/**
* Unauthorized
*/
diff --git a/airflow-core/src/airflow/ui/src/pages/TaskInstance/ExtraLinks.tsx b/airflow-core/src/airflow/ui/src/pages/TaskInstance/ExtraLinks.tsx
index e30c4b92d6e..878f06bb77c 100644
--- a/airflow-core/src/airflow/ui/src/pages/TaskInstance/ExtraLinks.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/TaskInstance/ExtraLinks.tsx
@@ -31,11 +31,11 @@ export const ExtraLinks = () => {
taskId,
});
- return data && Object.keys(data).length > 0 ? (
+ return data && Object.keys(data.extra_links).length > 0 ? (
<Box py={1}>
<Heading size="sm">Extra Links</Heading>
<HStack gap={2} py={2}>
- {Object.entries(data).map(([key, value], _) =>
+ {Object.entries(data.extra_links).map(([key, value], _) =>
value === null ? undefined : (
<Button asChild colorPalette="blue" key={key} variant="surface">
<a href={value} rel="noreferrer" target="_blank">
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_extra_links.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_extra_links.py
index 24a7de4556c..4366d8bbd9d 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_extra_links.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_extra_links.py
@@ -20,6 +20,7 @@ import os
import pytest
+from airflow.api_fastapi.core_api.datamodels.extra_links import ExtraLinkCollectionResponse
from airflow.dag_processing.bundles.manager import DagBundlesManager
from airflow.models.dagbag import DagBag
from airflow.models.xcom import XComModel as XCom
@@ -169,9 +170,13 @@ class TestGetExtraLinks:
)
assert response.status_code == 200
- assert response.json() == {
- "Google Custom": "http://google.com/custom_base_link?search=TEST_LINK_VALUE"
- }
+ assert (
+ response.json()
+ == ExtraLinkCollectionResponse(
+ extra_links={"Google Custom": "http://google.com/custom_base_link?search=TEST_LINK_VALUE"},
+ total_entries=1,
+ ).model_dump()
+ )
def test_should_respond_200_missing_xcom(self, test_client):
response = test_client.get(
@@ -179,7 +184,10 @@ class TestGetExtraLinks:
)
assert response.status_code == 200
- assert response.json() == {"Google Custom": None}
+ assert (
+ response.json()
+ == ExtraLinkCollectionResponse(extra_links={"Google Custom": None}, total_entries=1).model_dump()
+ )
def test_should_respond_200_multiple_links(self, test_client, session):
XCom.set(
@@ -213,10 +221,16 @@ class TestGetExtraLinks:
)
assert response.status_code == 200
- assert response.json() == {
- "BigQuery Console #1": "https://console.cloud.google.com/bigquery?j=TEST_LINK_VALUE_1",
- "BigQuery Console #2": "https://console.cloud.google.com/bigquery?j=TEST_LINK_VALUE_2",
- }
+ assert (
+ response.json()
+ == ExtraLinkCollectionResponse(
+ extra_links={
+ "BigQuery Console #1": "https://console.cloud.google.com/bigquery?j=TEST_LINK_VALUE_1",
+ "BigQuery Console #2": "https://console.cloud.google.com/bigquery?j=TEST_LINK_VALUE_2",
+ },
+ total_entries=2,
+ ).model_dump()
+ )
def test_should_respond_200_multiple_links_missing_xcom(self, test_client):
response = test_client.get(
@@ -224,7 +238,13 @@ class TestGetExtraLinks:
)
assert response.status_code == 200
- assert response.json() == {"BigQuery Console #1": None, "BigQuery Console #2": None}
+ assert (
+ response.json()
+ == ExtraLinkCollectionResponse(
+ extra_links={"BigQuery Console #1": None, "BigQuery Console #2": None},
+ total_entries=2,
+ ).model_dump()
+ )
@pytest.mark.mock_plugin_manager(plugins=[AirflowPluginWithOperatorLinks])
def test_should_respond_200_support_plugins(self, test_client):
@@ -233,11 +253,17 @@ class TestGetExtraLinks:
)
assert response, response.status_code == 200
- assert response.json() == {
- "Google Custom": None,
- "Google": "https://www.google.com",
- "S3": ("https://s3.amazonaws.com/airflow-logs/TEST_DAG_ID/TEST_SINGLE_LINK/"),
- }
+ assert (
+ response.json()
+ == ExtraLinkCollectionResponse(
+ extra_links={
+ "Google Custom": None,
+ "Google": "https://www.google.com",
+ "S3": ("https://s3.amazonaws.com/airflow-logs/TEST_DAG_ID/TEST_SINGLE_LINK/"),
+ },
+ total_entries=3,
+ ).model_dump()
+ )
@pytest.mark.xfail(reason="TODO: TaskSDK need to fix this, Extra links should work for mapped operator")
def test_should_respond_200_mapped_task_instance(self, test_client):
@@ -255,9 +281,13 @@ class TestGetExtraLinks:
params={"map_index": map_index},
)
assert response.status_code == 200
- assert response.json() == {
- "Google Custom": "http://google.com/custom_base_link?search=TEST_LINK_VALUE_1"
- }
+ assert (
+ response.json()
+ == ExtraLinkCollectionResponse(
+ extra_links={"Google Custom": "http://google.com/custom_base_link?search=TEST_LINK_VALUE_1"},
+ total_entries=1,
+ ).model_dump()
+ )
def test_should_respond_401_unauthenticated(self, unauthenticated_test_client):
response = unauthenticated_test_client.get(
diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
index c9fe8aaa0ae..5f37f0b3b0d 100644
--- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py
+++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
@@ -16,12 +16,9 @@
# under the License.
# generated by datamodel-codegen:
-# filename: http://0.0.0.0:8080/openapi.json
+# filename: http://0.0.0.0:28080/openapi.json
# version: 0.28.2
-# TODO (47918) let's be a bit more forgiving for our generated datamodels for now
-# mypy: disable-error-code="assignment"
-
from __future__ import annotations
from datetime import datetime, timedelta
@@ -459,7 +456,7 @@ class DagVersionResponse(BaseModel):
id: Annotated[UUID, Field(title="Id")]
version_number: Annotated[int, Field(title="Version Number")]
dag_id: Annotated[str, Field(title="Dag Id")]
- bundle_name: Annotated[str, Field(title="Bundle Name")]
+ bundle_name: Annotated[str | None, Field(title="Bundle Name")] = None
bundle_version: Annotated[str | None, Field(title="Bundle Version")] = None
created_at: Annotated[datetime, Field(title="Created At")]
bundle_url: Annotated[str | None, Field(title="Bundle Url")] = None
@@ -503,6 +500,15 @@ class EventLogResponse(BaseModel):
extra: Annotated[str | None, Field(title="Extra")] = None
+class ExtraLinkCollectionResponse(BaseModel):
+ """
+ Extra Links Response.
+ """
+
+ extra_links: Annotated[dict[str, str | None], Field(title="Extra Links")]
+ total_entries: Annotated[int, Field(title="Total Entries")]
+
+
class FastAPIAppResponse(BaseModel):
"""
Serializer for Plugin FastAPI App responses.
@@ -544,7 +550,7 @@ class ImportErrorResponse(BaseModel):
import_error_id: Annotated[int, Field(title="Import Error Id")]
timestamp: Annotated[datetime, Field(title="Timestamp")]
filename: Annotated[str, Field(title="Filename")]
- bundle_name: Annotated[str, Field(title="Bundle Name")]
+ bundle_name: Annotated[str | None, Field(title="Bundle Name")] = None
stack_trace: Annotated[str, Field(title="Stack Trace")]
@@ -1098,11 +1104,11 @@ class DAGDetailsResponse(BaseModel):
dag_id: Annotated[str, Field(title="Dag Id")]
dag_display_name: Annotated[str, Field(title="Dag Display Name")]
is_paused: Annotated[bool, Field(title="Is Paused")]
- is_active: Annotated[bool, Field(title="Is Active")]
+ is_stale: Annotated[bool, Field(title="Is Stale")]
last_parsed_time: Annotated[datetime | None, Field(title="Last Parsed Time")] = None
last_expired: Annotated[datetime | None, Field(title="Last Expired")] = None
- bundle_name: Annotated[str, Field(title="Bundle Name")]
- relative_fileloc: Annotated[str, Field(title="Relative Fileloc")]
+ bundle_name: Annotated[str | None, Field(title="Bundle Name")] = None
+ relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")] = None
fileloc: Annotated[str, Field(title="Fileloc")]
description: Annotated[str | None, Field(title="Description")] = None
timetable_summary: Annotated[str | None, Field(title="Timetable Summary")] = None
@@ -1151,11 +1157,11 @@ class DAGResponse(BaseModel):
dag_id: Annotated[str, Field(title="Dag Id")]
dag_display_name: Annotated[str, Field(title="Dag Display Name")]
is_paused: Annotated[bool, Field(title="Is Paused")]
- is_active: Annotated[bool, Field(title="Is Active")]
+ is_stale: Annotated[bool, Field(title="Is Stale")]
last_parsed_time: Annotated[datetime | None, Field(title="Last Parsed Time")] = None
last_expired: Annotated[datetime | None, Field(title="Last Expired")] = None
- bundle_name: Annotated[str, Field(title="Bundle Name")]
- relative_fileloc: Annotated[str, Field(title="Relative Fileloc")]
+ bundle_name: Annotated[str | None, Field(title="Bundle Name")] = None
+ relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")] = None
fileloc: Annotated[str, Field(title="Fileloc")]
description: Annotated[str | None, Field(title="Description")] = None
timetable_summary: Annotated[str | None, Field(title="Timetable Summary")] = None
@@ -1207,7 +1213,7 @@ class DAGRunResponse(BaseModel):
last_scheduling_decision: Annotated[datetime | None, Field(title="Last Scheduling Decision")] = None
run_type: DagRunType
state: DagRunState
- triggered_by: DagRunTriggeredByType
+ triggered_by: DagRunTriggeredByType | None = None
conf: Annotated[dict[str, Any], Field(title="Conf")]
note: Annotated[str | None, Field(title="Note")] = None
dag_versions: Annotated[list[DagVersionResponse], Field(title="Dag Versions")]
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py b/airflow-ctl/tests/airflow_ctl/api/__init__.py
similarity index 82%
copy from airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py
copy to airflow-ctl/tests/airflow_ctl/api/__init__.py
index 1e86c5a4bc2..13a83393a91 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/extra_links.py
+++ b/airflow-ctl/tests/airflow_ctl/api/__init__.py
@@ -14,12 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __future__ import annotations
-
-from pydantic import RootModel
-
-
-class ExtraLinksResponse(RootModel):
- """Extra Links Response."""
-
- root: dict[str, str | None]
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_operations.py b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
index 5a37aa3ddbb..bf7f388fdb5 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_operations.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_operations.py
@@ -354,7 +354,6 @@ class TestDagOperations:
dag_id="dag_id",
dag_display_name="dag_display_name",
is_paused=False,
- is_active=True,
last_parsed_time=datetime.datetime(2024, 12, 31, 23, 59, 59),
last_expired=datetime.datetime(2025, 1, 1, 0, 0, 0),
fileloc="fileloc",
@@ -375,13 +374,13 @@ class TestDagOperations:
owners=["apache-airflow"],
file_token="file_token",
bundle_name="bundle_name",
+ is_stale=False,
)
dag_details_response = DAGDetailsResponse(
dag_id="dag_id",
dag_display_name="dag_display_name",
is_paused=False,
- is_active=True,
last_parsed_time=datetime.datetime(2024, 12, 31, 23, 59, 59),
last_expired=datetime.datetime(2025, 1, 1, 0, 0, 0),
fileloc="fileloc",
@@ -415,6 +414,7 @@ class TestDagOperations:
file_token="file_token",
concurrency=1,
bundle_name="bundle_name",
+ is_stale=False,
)
def test_get(self):
diff --git a/pyproject.toml b/pyproject.toml
index 7070d5578f3..906c0d836c0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1189,6 +1189,11 @@ module=[
]
ignore_errors = true
+# airflowctl autogenered datamodels
+[[tool.mypy.overrides]]
+module="airflowctl.api.datamodels.*"
+ignore_errors = true
+
[dependency-groups]
dev = [
"apache-airflow[all]",