From 2b7342b90284c7d9b6ede9a3fe56ad07d83fb913 Mon Sep 17 00:00:00 2001 From: jomo Date: Thu, 1 Feb 2024 01:04:49 +0100 Subject: [PATCH] update openapi docs for PUT request --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index cc4092d..eb66394 100644 --- a/main.py +++ b/main.py @@ -44,7 +44,11 @@ async def list_items(db: Session = Depends(get_db)): return {i.id: i for i in items} -@app.put("/api/items/{id}") +@app.put( + "/api/items/{id}", + status_code=201, + responses={201: {"description": "created"}, 204: {"description": "updated"}}, +) async def put_item(id: str, item: Item, db: Session = Depends(get_db)): if item.last_updated is None: item.last_updated = month_timestamp()