Coverage for docs_src / body_multiple_params / tutorial005_an_py310.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from typing import Annotated 1abefcd

2 

3from fastapi import Body, FastAPI 1abefcd

4from pydantic import BaseModel 1abefcd

5 

6app = FastAPI() 1abefcd

7 

8 

9class Item(BaseModel): 1abefcd

10 name: str 1abcd

11 description: str | None = None 1abefcd

12 price: float 1abcd

13 tax: float | None = None 1abefcd

14 

15 

16@app.put("/items/{item_id}") 1abefcd

17async def update_item(item_id: int, item: Annotated[Item, Body(embed=True)]): 1abefcd

18 results = {"item_id": item_id, "item": item} 1ghijklmn

19 return results 1ghijklmn