diff --git a/docs/tutorial/src/tutorial34-01.py b/docs/tutorial/src/tutorial34-01.py deleted file mode 100644 index 6c8b101ba..000000000 --- a/docs/tutorial/src/tutorial34-01.py +++ /dev/null @@ -1,17 +0,0 @@ -from fastapi import Body, FastAPI -from pydantic import BaseModel, Schema - -app = FastAPI() - - -class Item(BaseModel): - name: str - description: str = Schema(None, title="The description of the item", max_length=300) - price: float = Schema(..., gt=0, description="The price must be greater than zero") - tax: float = None - - -@app.put("/items/{item_id}") -async def update_item(*, item_id: int, item: Item = Body(..., embed=True)): - results = {"item_id": item_id, "item": item} - return results diff --git a/docs/tutorial/src/tutorial34-02.py b/docs/tutorial/src/tutorial34-02.py deleted file mode 100644 index 3f4f53265..000000000 --- a/docs/tutorial/src/tutorial34-02.py +++ /dev/null @@ -1,29 +0,0 @@ -from fastapi import Body, FastAPI -from pydantic import BaseModel, Schema - -app = FastAPI() - - -class Item(BaseModel): - name: str - description: str = None - price: float - tax: float = None - - -@app.put("/items/{item_id}") -async def update_item( - *, - item_id: int, - item: Item = Body( - ..., - example={ - "name": "Foo", - "description": "A very nice Item", - "price": 35.4, - "tax": 3.2, - }, - ) -): - results = {"item_id": item_id, "item": item} - return results diff --git a/scripts/rename_tutorial_src_files.py b/scripts/rename_tutorial_src_files.py index 02878adf9..9ac620e86 100644 --- a/scripts/rename_tutorial_src_files.py +++ b/scripts/rename_tutorial_src_files.py @@ -4,8 +4,9 @@ from string import digits #%% -directory = Path("../docs/tutorial/src") -output_directory = Path("../docs/tutorial/out") +directory = Path("./docs/tutorial/src") +output_directory = Path("./docs/tutorial/out") +output_directory.mkdir(exist_ok=True) files = sorted([Path(f) for f in directory.iterdir()]) for i, f in enumerate(files): f: Path