Home / Function/ update_item() — fastapi Function Reference

update_item() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  70e0a458_870a_db8c_5e2f_2c4468a63021["update_item()"]
  7e870b86_0d98_211e_50cb_657f1bc9e159["tutorial002_py39.py"]
  70e0a458_870a_db8c_5e2f_2c4468a63021 -->|defined in| 7e870b86_0d98_211e_50cb_657f1bc9e159
  1ac1bc37_1a47_e7e2_9156_ab0473094700["jsonable_encoder()"]
  70e0a458_870a_db8c_5e2f_2c4468a63021 -->|calls| 1ac1bc37_1a47_e7e2_9156_ab0473094700
  style 70e0a458_870a_db8c_5e2f_2c4468a63021 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs_src/body_updates/tutorial002_py39.py lines 31–37

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_py39.py.
Where is update_item() defined?
update_item() is defined in docs_src/body_updates/tutorial002_py39.py at line 31.
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