fastapi icon indicating copy to clipboard operation
fastapi copied to clipboard

🐛 Fix parameterless `Depends()` with generics

Open nzig opened this issue 1 year ago • 7 comments

Previously, using parameterless Depends() in a generic context would bind the dependency to the first encountered concrete type.

Fixes #9450.

nzig avatar May 02 '23 19:05 nzig

📝 Docs preview for commit a8cb51402b016d85475a27666acd4558ef932a84 at: https://64515f2306603a0078b9209c--fastapi.netlify.app

github-actions[bot] avatar May 02 '23 19:05 github-actions[bot]

Looking forward to this fix. I want to use code from #9450 as example to implement injection of contollers in my project

PinkOatmeal avatar May 22 '23 10:05 PinkOatmeal

Hi @nzig, I've been watching this pr all month. And I'm already beginning to think that if it will be put in, it will not happen very soon. But it's a very cool fix, which will allow to write less monotonous code for your classes. Maybe it's possible to do something to get this pr accepted faster?

9en9i avatar May 31 '23 07:05 9en9i

@9en9i That's up to @tiangolo. He's the only one that can merge PRs.

nzig avatar Jun 10 '23 16:06 nzig

@tiangolo hi, is it possible that this bug fix request will ever be accepted?

9en9i avatar Nov 15 '23 15:11 9en9i

@Kludex @JarroVGIT @jgould22 @ycd Perhaps one of you can somehow contribute to the promotion of this pull request? This request fixes a feature that was added a little less than a year ago, and it would be nice to get full functionality.

9en9i avatar Nov 15 '23 15:11 9en9i

@tiangolo hi! This is a very cool feature that makes the code more readable and clean. Should we hope for its will be accepted?

FieryDruid avatar Jan 24 '24 10:01 FieryDruid

Thanks @nzig! :rocket:

And thanks everyone for the discussion. :coffee:

This will be available in the next hours in FastAPI 0.110.1 :tada:

tiangolo avatar Apr 02 '24 02:04 tiangolo