Coverage for docs_src / response_model / tutorial002_py310.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1from fastapi import FastAPI 1abc

2from pydantic import BaseModel, EmailStr 1abc

3 

4app = FastAPI() 1abc

5 

6 

7class UserIn(BaseModel): 1abc

8 username: str 1abc

9 password: str 1abc

10 email: EmailStr 1abc

11 full_name: str | None = None 1abc

12 

13 

14# Don't do this in production! 

15@app.post("/user/") 1abc

16async def create_user(user: UserIn) -> UserIn: 1abc

17 return user 1def