kaxil commented on code in PR #55080:
URL: https://github.com/apache/airflow/pull/55080#discussion_r2311679326
##########
airflow-core/src/airflow/api_fastapi/execution_api/versions/__init__.py:
##########
@@ -25,11 +25,14 @@
AddDagRunStateFieldAndPreviousEndpoint,
AddIncludePriorDatesToGetXComSlice,
)
-from airflow.api_fastapi.execution_api.versions.v2025_09_23 import
AddDagVersionIdField
+from airflow.api_fastapi.execution_api.versions.v2025_09_23 import (
+ AcceptNullXComSetValue,
+ AddDagVersionIdField,
+)
bundle = VersionBundle(
HeadVersion(),
- Version("2025-09-23", AddDagVersionIdField),
+ Version("2025-09-23", AddDagVersionIdField, AcceptNullXComSetValue),
Review Comment:
We are ok without the migration since technically this was a bug in FastAPI.
Code:
```py
from fastapi import FastAPI, Body
from fastapi.testclient import TestClient
from pydantic import JsonValue
from typing import Annotated
app = FastAPI()
@app.post('/echo')
async def echo(body: Annotated[JsonValue, Body()]):
return {'received': body, 'type': str(type(body))}
client = TestClient(app)
print('1. Testing json=None (empty body):')
try:
response = client.post('/echo', json=None)
print(' Status:', response.status_code)
if response.status_code == 200:
print(' Response:', response.json())
else:
print(' Error:', response.text)
except Exception as e:
print(' Exception:', e)
print()
print('2. Testing content=\"null\" (actual JSON null):')
try:
response = client.post('/echo', content='null', headers={'Content-Type':
'application/json'})
print(' Status:', response.status_code)
if response.status_code == 200:
print(' Response:', response.json())
else:
print(' Error:', response.text)
except Exception as e:
print(' Exception:', e)
```
```
1. Testing json=None (empty body):
Status: 422
Error: {"detail":[{"type":"missing","loc":["body"],"msg":"Field
required","input":null}]}
2. Testing content="null" (actual JSON null):
Status: 422
Error: {"detail":[{"type":"missing","loc":["body"],"msg":"Field
required","input":null}]}
```
--
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]