correctly calculate cache key for sub dependencies#3684
Conversation
When sub dependencies are derived, the cache key would be calculated incorrectly if the sub dependency is a Security dependency with scopes.
|
@tiangolo is there anything I can do to have this looked at? |
|
Inquisitive minds want to know... |
Codecov Report
@@ Coverage Diff @@
## master #3684 +/- ##
============================================
- Coverage 100.00% 88.64% -11.36%
============================================
Files 538 503 -35
Lines 13872 12957 -915
============================================
- Hits 13872 11486 -2386
- Misses 0 1471 +1471
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
📝 Docs preview for commit 6db35c0 at: https://631214f7ef40931be7f74c4f--fastapi.netlify.app |
|
Thanks for the interest and work @ojii! I'm trying this and I see that the test passes even without the changes. I'm also trying several examples locally copying things from that issue, but it seems to work, or I'm not understanding the problem correctly. But I have the feeling that this was solved in #2945 Could you check that one? That fix is available in FastAPI |
|
@tiangolo that fix looks okay to me. |
This fixes #469 (at least partially).
When sub dependencies are derived, the cache key would be calculated incorrectly if the sub dependency is a Security dependency with scopes. This change ensures the
cache_keyis re-calculated whenever its constituent parts are modified.This solves the problem of
SecurityScopesnot having the correct value, but now the dependency passed toSecuritycan be invoked multiple times (in the provided test it is invoked twice).