mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-25 17:32:53 -04:00
✨ Add support for function return type annotations to declare the response_model (#1436)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
@@ -14,6 +14,6 @@ class UserIn(BaseModel):
|
||||
|
||||
|
||||
# Don't do this in production!
|
||||
@app.post("/user/", response_model=UserIn)
|
||||
async def create_user(user: UserIn):
|
||||
@app.post("/user/")
|
||||
async def create_user(user: UserIn) -> UserIn:
|
||||
return user
|
||||
|
||||
Reference in New Issue
Block a user