mirror of
https://github.com/fastapi/fastapi.git
synced 2026-10-22 09:55:32 -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:
1 parent
efc12c5cdb
commit
d0573f5713
18 files changed
+1368
-58
No files matched your search
@@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
from fastapi import FastAPI
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
@@ -18,5 +20,5 @@ class UserOut(BaseModel):
|
||||
|
||||
|
||||
@app.post("/user/", response_model=UserOut)
|
||||
async def create_user(user: UserIn):
|
||||
async def create_user(user: UserIn) -> Any:
|
||||
return user
|
||||
Reference in new issue
Block a user