mirror of https://github.com/tiangolo/fastapi.git
📝 Update code examples in docs for body, replace name `create_item` with `update_item` when appropriate (#5913)
This commit is contained in:
parent
d5498274f9
commit
e9ffa20c8e
|
|
@ -15,5 +15,5 @@ app = FastAPI()
|
|||
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def create_item(item_id: int, item: Item):
|
||||
async def update_item(item_id: int, item: Item):
|
||||
return {"item_id": item_id, **item.dict()}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ app = FastAPI()
|
|||
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def create_item(item_id: int, item: Item):
|
||||
async def update_item(item_id: int, item: Item):
|
||||
return {"item_id": item_id, **item.dict()}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ app = FastAPI()
|
|||
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def create_item(item_id: int, item: Item, q: Union[str, None] = None):
|
||||
async def update_item(item_id: int, item: Item, q: Union[str, None] = None):
|
||||
result = {"item_id": item_id, **item.dict()}
|
||||
if q:
|
||||
result.update({"q": q})
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ app = FastAPI()
|
|||
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def create_item(item_id: int, item: Item, q: str | None = None):
|
||||
async def update_item(item_id: int, item: Item, q: str | None = None):
|
||||
result = {"item_id": item_id, **item.dict()}
|
||||
if q:
|
||||
result.update({"q": q})
|
||||
|
|
|
|||
Loading…
Reference in New Issue