mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-31 18:20:45 -05:00
* Fix for - [FEATURE] Remove *, where it's not needed #1234 * 🔥 Remove unnecessary arg *, * 🎨 Update docs format highlight lines Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
23 lines
386 B
Python
23 lines
386 B
Python
from fastapi import FastAPI
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class UserIn(BaseModel):
|
|
username: str
|
|
password: str
|
|
email: EmailStr
|
|
full_name: str = None
|
|
|
|
|
|
class UserOut(BaseModel):
|
|
username: str
|
|
email: EmailStr
|
|
full_name: str = None
|
|
|
|
|
|
@app.post("/user/", response_model=UserOut)
|
|
async def create_user(user: UserIn):
|
|
return user
|