Home / Function/ update_item() — fastapi Function Reference

update_item() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  802dade0_8f53_27fc_d843_a117c96f716b["update_item()"]
  8729a328_33f1_5a00_1d1d_6145a00663f9["tutorial005_py39.py"]
  802dade0_8f53_27fc_d843_a117c96f716b -->|defined in| 8729a328_33f1_5a00_1d1d_6145a00663f9
  style 802dade0_8f53_27fc_d843_a117c96f716b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs_src/schema_extra_example/tutorial005_py39.py lines 17–51

async def update_item(
    *,
    item_id: int,
    item: Item = Body(
        openapi_examples={
            "normal": {
                "summary": "A normal example",
                "description": "A **normal** item works correctly.",
                "value": {
                    "name": "Foo",
                    "description": "A very nice Item",
                    "price": 35.4,
                    "tax": 3.2,
                },
            },
            "converted": {
                "summary": "An example with converted data",
                "description": "FastAPI can convert price `strings` to actual `numbers` automatically",
                "value": {
                    "name": "Bar",
                    "price": "35.4",
                },
            },
            "invalid": {
                "summary": "Invalid data is rejected with an error",
                "value": {
                    "name": "Baz",
                    "price": "thirty five point four",
                },
            },
        },
    ),
):
    results = {"item_id": item_id, "item": item}
    return results

Domain

Subdomains

Frequently Asked Questions

What does update_item() do?
update_item() is a function in the fastapi codebase, defined in docs_src/schema_extra_example/tutorial005_py39.py.
Where is update_item() defined?
update_item() is defined in docs_src/schema_extra_example/tutorial005_py39.py at line 17.

Analyze Your Own Codebase

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

Try Supermodel Free