-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent add_api_route types #10236
Comments
This is a valid issue. The type hint of both Should be easy to fix - I don't know which one @tiangolo wants. |
Hey @Kludex I want to help on this issue if no one is interested, I have used FastAPI before in some hobby projects but this is my first OSS contribution! |
I'll take this if no one else is!
I would think
Happy to work with either |
Direct mounting of routesimport pathlib from fastapi import FastAPI, APIRouter class HelloRequest(pydantic.BaseModel): class HelloResponse(pydantic.BaseModel): class Hello:
app = FastAPI() Mounting of paths via Routerimport pathlib from fastapi import FastAPI, APIRouter class HelloRequest(pydantic.BaseModel): class HelloResponse(pydantic.BaseModel): class Hello:
class RootRouter: app = FastAPI() |
hi @Kludex Is this still a valid issue? I want to help on this issue if no one is interested |
Hi.. is closed? I like FastAPI and want to contribute.. |
Hi, this issue is closed ? |
Discussed in #10235
Originally posted by sidekick-eimantas September 12, 2023
First Check
Commit to Help
Example Code
Description
First example produces a mypy error:
Second example does not.
The types of
endpoint
parameter inFastAPI.add_api_route
andAPIRouter.add_api_route
are inconsistent.Operating System
macOS
Operating System Details
No response
FastAPI Version
0.103.1
Pydantic Version
2.3.0
Python Version
3.10.7
Additional Context
No response
The text was updated successfully, but these errors were encountered: