Coverage for docs_src/response_model/tutorial003_py310.py: 100%
16 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from typing import Any 1abc
3from fastapi import FastAPI 1abc
4from pydantic import BaseModel, EmailStr 1abc
6app = FastAPI() 1abc
9class UserIn(BaseModel): 1abc
10 username: str 1abc
11 password: str 1abc
12 email: EmailStr 1abc
13 full_name: str | None = None 1abc
16class UserOut(BaseModel): 1abc
17 username: str 1abc
18 email: EmailStr 1abc
19 full_name: str | None = None 1abc
22@app.post("/user/", response_model=UserOut) 1abc
23async def create_user(user: UserIn) -> Any: 1abc
24 return user 1abc