Skip to content

fix: Fix #4035 - incorrect deprecation warning issued when subclassing middlewares#4036

Merged
provinzkraut merged 1 commit intomainfrom
fix-middleware-deprecation-warning
Feb 27, 2025
Merged

fix: Fix #4035 - incorrect deprecation warning issued when subclassing middlewares#4036
provinzkraut merged 1 commit intomainfrom
fix-middleware-deprecation-warning

Conversation

@provinzkraut
Copy link
Copy Markdown
Member

@provinzkraut provinzkraut commented Feb 27, 2025

Fix a bug introduced in #3996 that would incorrectly issue a deprecation warning if a user subclassed a Litestar built-in middleware which itself subclasses AbstractMiddleware.

Fix consists of checking the mro to ensure we're only warning if the subclass has AbstractMiddleware as a direct ancestor within the user code.

Fix #4035

@provinzkraut provinzkraut requested review from a team as code owners February 27, 2025 16:49
@github-actions github-actions bot added area/middleware This PR involves changes to the middleware size: small type/bug pr/internal labels Feb 27, 2025
@provinzkraut provinzkraut enabled auto-merge (squash) February 27, 2025 16:50
@provinzkraut provinzkraut force-pushed the fix-middleware-deprecation-warning branch from 30ca1db to b95fda3 Compare February 27, 2025 16:58
@github-actions github-actions bot added area/dependencies This PR involves changes to the dependencies area/docs This PR involves changes to the documentation labels Feb 27, 2025
@provinzkraut provinzkraut force-pushed the fix-middleware-deprecation-warning branch from b95fda3 to 32bf3d3 Compare February 27, 2025 17:01
@github-actions github-actions bot removed the area/dependencies This PR involves changes to the dependencies label Feb 27, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.34%. Comparing base (05005ca) to head (32bf3d3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4036   +/-   ##
=======================================
  Coverage   98.34%   98.34%           
=======================================
  Files         348      348           
  Lines       15823    15823           
  Branches     1748     1748           
=======================================
  Hits        15561    15561           
  Misses        125      125           
  Partials      137      137           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@provinzkraut provinzkraut merged commit cc6148c into main Feb 27, 2025
26 checks passed
@provinzkraut provinzkraut deleted the fix-middleware-deprecation-warning branch February 27, 2025 17:06
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/4036

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

Labels

area/docs This PR involves changes to the documentation area/middleware This PR involves changes to the middleware pr/internal size: small type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Deprecation warning for AbstractMiddleware even though I am not using it

2 participants