Documentation is asking to type with fastapi.datastructures.UploadFile, but starlette.datastructures.UploadFile is actually used, causing a type error #9705
Unanswered
gabrieldemarmiesse
asked this question in
Questions
Replies: 2 comments 3 replies
-
|
What type checker? What version of the type checker? What command? |
Beta Was this translation helpful? Give feedback.
1 reply
This comment was marked as off-topic.
This comment was marked as off-topic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
Just run the script, the type of
some_fileisstarlette.datastructures.UploadFileinstead offastapi.datastructures.UploadFile. This is causing type checkers to flag this as an error.This example come straight from the documentation (the example with
UploadFileand the one showing how to do unit testing. So nothing exotic here.Operating System
Linux
Operating System Details
I work in Docker. But I'm pretty sure this type bug is unrelated to my operating system.
FastAPI Version
0.97.0
Python Version
Python 3.10.10
Additional Context
Using
isinstanceis also causing an issue:fails.
It is likely unrelated as those examples confirms the type is wrong, but the type checker I usually use is typeguard.
It fails on all the endpoints using
FileUploadwithtypeguard.TypeCheckError: argument "file" (starlette.datastructures.UploadFile) is not an instance of fastapi.datastructures.UploadFileBeta Was this translation helpful? Give feedback.
All reactions