-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project?Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot useResponse
type hint as dependency annotation
#10127
Comments
Given how obvious the block is in code, should we assume that it was intentional and update the docs? |
This comment was marked as spam.
This comment was marked as spam.
Hi, any update on this issue? There is a similar issue to this one aswell Given a response defined in the api parametersThis code produces a
|
Hii, responses:Annotated[
Optional[Dict[Union[int,str],Dict[str,Any]]],
Doc(
"""
Additional responses that could be returned by this *path operation*.
It will be added to the generated OpenAPI (e.g. visible at `/docs`).
"""
),
]=None,
|
Privileged issue
Issue Content
FastAPI
0.95.0
introducedAnnotated
as a way to create dependencies (https://fastapi.tiangolo /release-notes/#0950).Before
0.95.0
,it was possible to useResponse
as a type hint for dependencies. After that, it was not possible anymore.Example that worked before:
As a workaround today, if you remove the
Response
type hint, it works as expected:The
Annotated
way also doesn't work:The text was updated successfully, but these errors were encountered: