✨ 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:
Yurii KarabasandSebastián Ramírez authored and GitHub committed 2023-01-07 17:45:48 +04:00
1 parent efc12c5cdb
commit d0573f5713
18 files changed
+1368 -58

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
from typing import Union
from typing import Any, Union
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
@@ -20,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