Home / Function/ update_item() — fastapi Function Reference

update_item() — fastapi Function Reference

Architecture documentation for the update_item() function in tutorial002_py310.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  00d20852_5b0e_b44c_03b2_48d140770a6f["update_item()"]
  d656c871_8c43_60f9_8467_afcff47434c8["tutorial002_py310.py"]
  00d20852_5b0e_b44c_03b2_48d140770a6f -->|defined in| d656c871_8c43_60f9_8467_afcff47434c8
  1ac1bc37_1a47_e7e2_9156_ab0473094700["jsonable_encoder()"]
  00d20852_5b0e_b44c_03b2_48d140770a6f -->|calls| 1ac1bc37_1a47_e7e2_9156_ab0473094700
  style 00d20852_5b0e_b44c_03b2_48d140770a6f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs_src/body_updates/tutorial002_py310.py lines 29–35

async def update_item(item_id: str, item: Item) -> Item:
    stored_item_data = items[item_id]
    stored_item_model = Item(**stored_item_data)
    update_data = item.model_dump(exclude_unset=True)
    updated_item = stored_item_model.model_copy(update=update_data)
    items[item_id] = jsonable_encoder(updated_item)
    return updated_item

Domain

Subdomains

Frequently Asked Questions

What does update_item() do?
update_item() is a function in the fastapi codebase, defined in docs_src/body_updates/tutorial002_py310.py.
Where is update_item() defined?
update_item() is defined in docs_src/body_updates/tutorial002_py310.py at line 29.
What does update_item() call?
update_item() calls 1 function(s): jsonable_encoder.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free