Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for ItemV2 (0.03 sec)

  1. docs_src/pydantic_v1_in_v2/tutorial003_an_py39.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        size: float
    
    
    class ItemV2(BaseModelV2):
        name: str
        description: Union[str, None] = None
        size: float
    
    
    app = FastAPI()
    
    
    @app.post("/items/", response_model=ItemV2)
    async def create_item(item: Item):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 445 bytes
    - Viewed (0)
  2. docs/de/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md

    {* ../../docs_src/pydantic_v1_in_v2/tutorial003_an_py310.py hl[2:3,6,12,21:22] *}
    
    Im obigen Beispiel ist das Eingabemodell ein Pydantic‑v1‑Modell, und das Ausgabemodell (definiert in `response_model=ItemV2`) ist ein Pydantic‑v2‑Modell.
    
    ### Pydantic v1 Parameter { #pydantic-v1-parameters }
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 24 10:28:19 UTC 2025
    - 6.3K bytes
    - Viewed (0)
  3. docs/en/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md

    {* ../../docs_src/pydantic_v1_in_v2/tutorial003_an_py310.py hl[2:3,6,12,21:22] *}
    
    In this example above, the input model is a Pydantic v1 model, and the output model (defined in `response_model=ItemV2`) is a Pydantic v2 model.
    
    ### Pydantic v1 parameters { #pydantic-v1-parameters }
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 5.5K bytes
    - Viewed (0)
  4. docs/es/docs/how-to/migrate-from-pydantic-v1-to-pydantic-v2.md

    {* ../../docs_src/pydantic_v1_in_v2/tutorial003_an_py310.py hl[2:3,6,12,21:22] *}
    
    En el ejemplo anterior, el modelo de entrada es un modelo de Pydantic v1 y el modelo de salida (definido en `response_model=ItemV2`) es un modelo de Pydantic v2.
    
    ### Parámetros de Pydantic v1 { #pydantic-v1-parameters }
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:16:35 UTC 2025
    - 5.6K bytes
    - Viewed (0)
  5. tests/test_generate_unique_id_function.py

        def post_root(item1: Item, item2: Item):
            return item1, item2  # pragma: nocover
    
        @router.post(
            "/router", response_model=list[Item], responses={404: {"model": list[Message]}}
        )
        def post_router(item1: Item, item2: Item):
            return item1, item2  # pragma: nocover
    
        app.include_router(router)
        client = TestClient(app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 66.7K bytes
    - Viewed (0)
  6. tests/test_dependency_duplicates.py

        return item
    
    
    def dependency(item2: Item):
        return item2
    
    
    def sub_duplicate_dependency(
        item: Item, sub_item: Item = Depends(duplicate_dependency)
    ):
        return [item, sub_item]
    
    
    @app.post("/with-duplicates")
    async def with_duplicates(item: Item, item2: Item = Depends(duplicate_dependency)):
        return [item, item2]
    
    
    @app.post("/no-duplicates")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8K bytes
    - Viewed (0)
  7. tests/test_schema_extra_examples.py

            item_id: str = Path(
                examples=["item_1", "item_2"],
            ),
        ):
            return item_id
    
        with pytest.warns(FastAPIDeprecationWarning):
    
            @app.get("/path_example_examples/{item_id}")
            def path_example_examples(
                item_id: str = Path(
                    example="item_overridden",
                    examples=["item_1", "item_2"],
                ),
            ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 32.2K bytes
    - Viewed (0)
  8. docs_src/extra_models/tutorial003_py39.py

        type: str = "car"
    
    
    class PlaneItem(BaseItem):
        type: str = "plane"
        size: int
    
    
    items = {
        "item1": {"description": "All my friends drive a low rider", "type": "car"},
        "item2": {
            "description": "Music is my aeroplane, it's my aeroplane",
            "type": "plane",
            "size": 5,
        },
    }
    
    
    @app.get("/items/{item_id}", response_model=Union[PlaneItem, CarItem])
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 644 bytes
    - Viewed (0)
  9. tests/test_openapi_examples.py

                    "summary": "Path One Summary",
                    "description": "Path One Description",
                    "value": "item_1",
                },
                "Path Two": {
                    "value": "item_2",
                },
            },
        ),
    ):
        return item_id
    
    
    @app.get("/query_examples/")
    def query_examples(
        data: Union[str, None] = Query(
            default=None,
            examples=[
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_extra_models/test_tutorial003.py

        assert response.json() == {
            "description": "All my friends drive a low rider",
            "type": "car",
        }
    
    
    def test_get_plane(client: TestClient):
        response = client.get("/items/item2")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "description": "Music is my aeroplane, it's my aeroplane",
            "type": "plane",
            "size": 5,
        }
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6K bytes
    - Viewed (0)
Back to top