mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-28 02:39:39 -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,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
|
||||
|
||||
Reference in New Issue
Block a user