Skip to content

Conversation

@ivantodorovich
Copy link
Contributor

@ivantodorovich ivantodorovich commented Oct 31, 2025

Recent merged changes in a5bae2b changed status.HTTP_422_UNPROCESSABLE_ENTITY to status.HTTP_422_UNPROCESSABLE_CONTENT in order to supress a deprecation warning emitted by the starlette >= 0.48 library.

However, older versions of starlette will simply break with this change.

Module 'starlette.status' has no attribute 'HTTP_422_UNPROCESSABLE_CONTENT'.
Did you mean: 'HTTP_422_UNPROCESSABLE_ENTITY'?

For this reason, we bump the minimum required version of fastapi to 0.120.0, which consumes newer versions of starlette where this is not an issue.

To be compatible with past and future versions, we simply use the integer value 422, aligning also with the updated fastapi documentation:

See:

@OCA-git-bot
Copy link
Contributor

Hi @lmignon,
some modules you are maintaining are being modified, check this out!

@ivantodorovich ivantodorovich force-pushed the 18.0-fix-fastapi-bump-version branch from 1661881 to 6bc3764 Compare October 31, 2025 18:53
Copy link
Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

@ivantodorovich IMO We should revert the change related to status.HTTP_422_UNPROCESSABLE_ENTITY to support the same range of starlette version as in fastapi "starlette>=0.40.0,<0.50.0". The depreciation has been introduced in starlette 0.48....

@ivantodorovich
Copy link
Contributor Author

Hi @lmignon !

What I don't like about that is that we will hit this issue in the future, at some point. Today it's a deprecation warning, but soon will be an exception.

But I see your point wanting to support older versions, too.. so perhaps we could do the same fastapi did in their project:

That is, replace the use of these constants with their simple integer value (e.g.: 422).
Or, maybe more elegantly, use the correct one depending on the starlette package version.

I'll update this PR with a new proposal

Starting from `starlette >= 0.48`, the `status.HTTP_422_UNPROCESSABLE_ENTITY`
emits a deprecation warning, as it has been replaced by
`status.HTTP_422_UNPROCESSABLE_CONTENT`.

To be compatible with past and future versions, we simply use the integer value
`422`, aligning also with the updated `fastapi` documentation:

See:
- fastapi/fastapi#14077
@ivantodorovich ivantodorovich force-pushed the 18.0-fix-fastapi-bump-version branch from 6bc3764 to 4c44017 Compare November 3, 2025 12:40
@ivantodorovich ivantodorovich changed the title [18.0] [FIX] fastapi: bump required version to 0.120.0 [18.0] [FIX] fastapi: support both starlette < and >= 0.48 Nov 3, 2025
@ivantodorovich
Copy link
Contributor Author

@lmignon when you have a moment, please check the new proposal 🙏🏻
Thanks!

@lmignon
Copy link
Contributor

lmignon commented Nov 3, 2025

Thank you @ivantodorovich. This fix is pragmatic and solve the issue without introducing additional constrain.

@lmignon
Copy link
Contributor

lmignon commented Nov 5, 2025

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-572-by-lmignon-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 6d42e07 into OCA:18.0 Nov 5, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 62b5c7e. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants