Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 101 for myitem (0.03 sec)

  1. tests/test_dependency_duplicates.py

    
    def test_sub_duplicates():
        response = client.post("/with-duplicates-sub", json={"data": "myitem"})
        assert response.status_code == 200, response.text
        assert response.json() == [
            {"data": "myitem"},
            [{"data": "myitem"}, {"data": "myitem"}],
        ]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8K bytes
    - Viewed (0)
  2. docs_src/dataclasses_/tutorial003_py310.py

    
    @dataclass
    class Item:
        name: str
        description: str | None = None
    
    
    @dataclass
    class Author:
        name: str
        items: list[Item] = field(default_factory=list)  # (3)
    
    
    app = FastAPI()
    
    
    @app.post("/authors/{author_id}/items/", response_model=Author)  # (4)
    async def create_author_items(author_id: str, items: list[Item]):  # (5)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  3. docs_src/dataclasses_/tutorial003_py39.py

    
    @dataclass
    class Item:
        name: str
        description: Union[str, None] = None
    
    
    @dataclass
    class Author:
        name: str
        items: list[Item] = field(default_factory=list)  # (3)
    
    
    app = FastAPI()
    
    
    @app.post("/authors/{author_id}/items/", response_model=Author)  # (4)
    async def create_author_items(author_id: str, items: list[Item]):  # (5)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_dataclasses/test_tutorial003.py

                                "items": {"$ref": "#/components/schemas/ValidationError"},
                            }
                        },
                    },
                    "Item": {
                        "title": "Item",
                        "required": ["name"],
                        "type": "object",
                        "properties": {
                            "name": {"title": "Name", "type": "string"},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  5. docs/de/docs/index.md

        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
        return {"item_name": item.name, "item_id": item_id}
    ```
    
    Der `fastapi dev`-Server sollte automatisch neu laden.
    
    ### Interaktive API-Dokumentation aktualisieren { #interactive-api-docs-upgrade }
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 09:39:53 UTC 2025
    - 25.8K bytes
    - Viewed (0)
  6. docs/en/docs/index.md

        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
        return {"item_name": item.name, "item_id": item_id}
    ```
    
    The `fastapi dev` server should reload automatically.
    
    ### Interactive API docs upgrade { #interactive-api-docs-upgrade }
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Dec 25 11:01:37 UTC 2025
    - 23.5K bytes
    - Viewed (0)
  7. tests/test_union_body.py

    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Optional[str] = None
    
    
    class OtherItem(BaseModel):
        price: int
    
    
    @app.post("/items/")
    def save_union_body(item: Union[OtherItem, Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_post_other_item():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 4.3K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py

    DESCRIPTIONS = {
        "tutorial003": "Create an item with all the information, name, description, price, tax and a set of unique tags",
        "tutorial004": dedent("""
            Create an item with all the information:
    
            - **name**: each item must have a name
            - **description**: a long description
            - **price**: required
            - **tax**: if the item doesn't have tax, you can omit this
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_body_nested_models/test_tutorial004.py

                "description": "A very nice Item",
                "price": 35.4,
                "tax": 3.2,
                "tags": ["foo", "bar", "foo"],
                "image": {"url": "http://example.com/image.png", "name": "example image"},
            },
        )
        assert response.status_code == 200, response.text
        assert response.json() == {
            "item_id": 123,
            "item": {
                "name": "Foo",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 8.8K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_body_multiple_params/test_tutorial002.py

                        },
                        "summary": "Update Item",
                    },
                },
            },
            "components": {
                "schemas": {
                    "Body_update_item_items__item_id__put": {
                        "properties": {
                            "item": {
                                "$ref": "#/components/schemas/Item",
                            },
                            "user": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 11K bytes
    - Viewed (0)
Back to top