Repository navigation
2.2.0 (2023-09-22) Generators support
With this release, async and sync generator function support was added!
This case supports incoming and return types casting both
from fast_depends import inject
@inject
def func(a: str) -> int:
for _ in range(3)
yield a
for i in func(1):
assert i == "1"Also, @inject has an option to disable pydantic validation with cast=False. This way Depends and your custom fields are still working, but pydantic is not even called.
from fast_depends import inject
@inject(cast=False)
def func(a: str) -> int:
return a
assert func(1.0) == 1.0