This is an automated email from the ASF dual-hosted git repository.
henry3260 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 71617c77bb2 Record that StrictBaseModel is for request bodies only
(#75639)
71617c77bb2 is described below
commit 71617c77bb2aae8ba6310585912610a67400b641
Author: Henry Chen <[email protected]>
AuthorDate: Sun Nov 1 18:10:47 2026 +0800
Record that StrictBaseModel is for request bodies only (#75639)
The seven response models that moved back to BaseModel in #75610 had
picked StrictBaseModel because its docstring reads as a general
recommendation: use it where extra fields should not be accepted.
Nothing at the class recorded why that is limited to request bodies. A
response model is instantiated from a source object that holds more than
it returns, so forbidding extra fields rejects its own construction; and
the setting reaches generated clients as additionalProperties: false, so
an older airflowctl rejects a field a newer server adds. The second
reason is what #75610 had to fix, and neither was written down where the
next response model would look.
---
airflow-core/src/airflow/api_fastapi/core_api/base.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/base.py
b/airflow-core/src/airflow/api_fastapi/core_api/base.py
index b88cb955650..75577e11cb1 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/base.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/base.py
@@ -41,7 +41,10 @@ class StrictBaseModel(BaseModel):
"""
StrictBaseModel is a base Pydantic model for REST API that does not allow
any extra fields.
- Use this class for models that should not have any extra fields in the
payload.
+ Use this class for request bodies only. A response model is instantiated
from a
+ source object that holds more than the model returns, which
``extra="forbid"``
+ rejects; it also sets ``additionalProperties: false`` in the spec, which
makes
+ generated clients such as airflowctl reject fields that a newer server
adds.
:meta private:
"""