Created
October 19, 2022 08:18
-
-
Save vndee/6c17af9d142361c40d91c510e21f69b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydantic import BaseModel | |
class Item(BaseModel): | |
name: str | |
price: float | |
quantity: int | |
@app.put("/update/{item_id}") | |
async def update_item(item_id: int, item: Item) -> Response: | |
return JSONResponse({ | |
"item_id": item_id, | |
"item_name": item.name, | |
"item_price": item.price, | |
"item_quantity": item.quantity | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment