Check for Engin-injected parameter using the dependency function name#65
Conversation
… instead of __engin__ magic field
8d993a9 to
f8a26a2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
==========================================
- Coverage 90.97% 90.96% -0.02%
==========================================
Files 19 19
Lines 1197 1195 -2
Branches 161 161
==========================================
- Hits 1089 1087 -2
Misses 67 67
Partials 41 41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looks good! Thanks for the fix. I think it would be good to add a comment above the If you want you can also update the CHANGELOG.md or I can do it later. I will probably add an improvement to the |
|
@invokermain, I have added a Please let me know what's the planned change to the |
|
See pull request here: #67. I've only added a failing test case so far. |
Compatibility fix for
FastAPI>=0.121.3https://fastapi.tiangolo.com/release-notes/#01213
Due to the recent FastAPI release making
Dependsobject adataclass, using customDepends.__engin__attribute is no longer possible.The suggested fix leverages an approach which depends less on the internals of the FastAPI, and interacts with its public API — it checks for
Depends.dependencyfunction name (that is created by engin).The only potential issue, is someone using the same dependency function name
__inner_engin_dependency__, which is highly unlikely.