This is an automated email from the ASF dual-hosted git repository.

rahulvats 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 586530f388d Allow bundle_name to be None API response (#48794)
586530f388d is described below

commit 586530f388da2dc28dd0e9ace89fbed03d16b5ed
Author: Rahul Vats <[email protected]>
AuthorDate: Sat Apr 5 16:53:09 2025 +0530

    Allow bundle_name to be None API response (#48794)
    
    Allow bundle name to be none
---
 .../api_fastapi/core_api/datamodels/import_error.py       |  2 +-
 .../api_fastapi/core_api/openapi/v1-generated.yaml        |  4 +++-
 .../src/airflow/ui/openapi-gen/requests/schemas.gen.ts    |  9 ++++++++-
 .../src/airflow/ui/openapi-gen/requests/types.gen.ts      |  2 +-
 .../core_api/routes/public/test_import_error.py           | 15 +++++++++++++--
 5 files changed, 26 insertions(+), 6 deletions(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/import_error.py 
b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/import_error.py
index ccb72b95d65..10f6e959e27 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/import_error.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/import_error.py
@@ -29,7 +29,7 @@ class ImportErrorResponse(BaseModel):
     id: int = Field(alias="import_error_id")
     timestamp: datetime
     filename: str
-    bundle_name: str
+    bundle_name: str | None
     stacktrace: str = Field(alias="stack_trace")
 
 
diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-generated.yaml 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
index c01df4277d4..3170fe54bae 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
+++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
@@ -10074,7 +10074,9 @@ components:
           type: string
           title: Filename
         bundle_name:
-          type: string
+          anyOf:
+          - type: string
+          - type: 'null'
           title: Bundle Name
         stack_trace:
           type: string
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 3e231b9f4ea..17bd82c362d 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
@@ -4098,7 +4098,14 @@ export const $ImportErrorResponse = {
       title: "Filename",
     },
     bundle_name: {
-      type: "string",
+      anyOf: [
+        {
+          type: "string",
+        },
+        {
+          type: "null",
+        },
+      ],
       title: "Bundle Name",
     },
     stack_trace: {
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 f938fc4ac56..9358f5dd75d 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
@@ -1082,7 +1082,7 @@ export type ImportErrorResponse = {
   import_error_id: number;
   timestamp: string;
   filename: string;
-  bundle_name: string;
+  bundle_name: string | null;
   stack_trace: string;
 };
 
diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py
 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py
index 44209d7f7c3..4269feeaac3 100644
--- 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py
+++ 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py
@@ -82,12 +82,13 @@ def clear_db():
 def import_errors(session: Session = NEW_SESSION) -> list[ParseImportError]:
     _import_errors = [
         ParseImportError(
-            bundle_name=BUNDLE_NAME,
+            bundle_name=bundle,
             filename=filename,
             stacktrace=stacktrace,
             timestamp=timestamp,
         )
-        for filename, stacktrace, timestamp in zip(
+        for bundle, filename, stacktrace, timestamp in zip(
+            (BUNDLE_NAME, BUNDLE_NAME, None),
             (FILENAME1, FILENAME2, FILENAME3),
             (STACKTRACE1, STACKTRACE2, STACKTRACE3),
             (TIMESTAMP1, TIMESTAMP2, TIMESTAMP3),
@@ -148,6 +149,16 @@ class TestGetImportError:
                     "bundle_name": BUNDLE_NAME,
                 },
             ),
+            (
+                2,
+                200,
+                {
+                    "timestamp": from_datetime_to_zulu_without_ms(TIMESTAMP3),
+                    "filename": FILENAME3,
+                    "stack_trace": STACKTRACE3,
+                    "bundle_name": None,
+                },
+            ),
             (None, 404, {}),
         ],
     )

Reply via email to