Browse Source
Depends can be used with a direct form, which although not recommended, is still supported. The following code is problematic wrt. type checking. def dependency() -> str: return "dependency" @router.get("/") def endpoint(value: int = Depends(dependency)): pass Currently, `Depends(dependency)` returns Any, which then happily gets assigned to the int. This patch changes it to return a type matching what the dependency returns, making the above code fail type checking with mypy as it should.pull/11255/head
1 changed files with 15 additions and 7 deletions
Loading…
Reference in new issue