2.2.6
What's Changed
Provides you with the ability to setup pydantic config using @inject
@inject(pydantic_config={"str_max_length": 8})
def limited_str(a: str):
...
limited_str("*" * 9) # raises ValidationError
Also, added context manager method to override dependencies:
from fast_depends import Depends, dependency_provider, inject
def base_dep():
return 1
def override_dep():
return 2
@inject
def func(d=Depends(base_dep)):
return d
with dependency_provider.scope(base_dep, override_dep):
assert func() == 2
assert func() == 1
- feat (#38): add pydantic config option by @Lancetnik in #42
Full Changelog: 2.2.5...2.2.6