Skip to content

Record that StrictBaseModel is for request bodies only - #75639

Merged
henry3260 merged 1 commit into
apache:mainfrom
henry3260:document-strict-base-model
Nov 1, 2026
Merged

henry3260 merged 1 commit into
apache:mainfrom
henry3260:document-strict-base-model

Conversation

@henry3260

Copy link
Copy Markdown
Member

Why

#75610 moved seven response-only models off StrictBaseModel, but left the class itself untouched. Its docstring says to use it for "models that should not have any extra fields in the payload", which reads as a general recommendation — and is how those seven came to pick it.

Two reasons limit it to request bodies, and neither is recorded at the class:

What

The docstring states the constraint and both reasons. No behaviour change, no other file touched.

related: #75610


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

The seven response models that moved back to BaseModel in apache#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 apache#75610 had to fix, and neither was written down where the
next response model would look.

@fat-catTW fat-catTW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@Andrushika Andrushika left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing the follow-up :)

@henry3260
henry3260 enabled auto-merge (squash) October 30, 2026 18:14

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up.

@henry3260
henry3260 merged commit 71617c7 into apache:main Nov 1, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants