Search Options

Results per page
Sort
Preferred Languages
Advance

Results 541 - 550 of 849 for Pydantics (0.05 sec)

  1. tests/test_tutorial/test_extra_models/test_tutorial003.py

                    "PlaneItem": {
                        "title": "PlaneItem",
                        "required": IsOneOf(
                            ["description", "type", "size"],
                            # TODO: remove when deprecating Pydantic v1
                            ["description", "size"],
                        ),
                        "type": "object",
                        "properties": {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 04 20:47:07 UTC 2023
    - 5.1K bytes
    - Viewed (0)
  2. docs_src/extra_models/tutorial001_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel, EmailStr
    
    app = FastAPI()
    
    
    class UserIn(BaseModel):
        username: str
        password: str
        email: EmailStr
        full_name: str | None = None
    
    
    class UserOut(BaseModel):
        username: str
        email: EmailStr
        full_name: str | None = None
    
    
    class UserInDB(BaseModel):
        username: str
        hashed_password: str
        email: EmailStr
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 899 bytes
    - Viewed (0)
  3. docs_src/path_operation_configuration/tutorial004_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 676 bytes
    - Viewed (0)
  4. tests/test_filter_pydantic_sub_model/app_pv1.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI
    from pydantic import BaseModel, validator
    
    app = FastAPI()
    
    
    class ModelB(BaseModel):
        username: str
    
    
    class ModelC(ModelB):
        password: str
    
    
    class ModelA(BaseModel):
        name: str
        description: Optional[str] = None
        model_b: ModelB
    
        @validator("name")
        def lower_username(cls, name: str, values):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 784 bytes
    - Viewed (0)
  5. docs_src/body_multiple_params/tutorial004_an_py310.py

    from typing import Annotated
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    class User(BaseModel):
        username: str
        full_name: str | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 643 bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/query-params-str-validations.md

    ```
    
    ////
    
    /// tip
    
    Pydantic, ❔ βš«οΈβ” πŸ‹οΈ 🌐 πŸ’½ πŸ”¬ &amp; πŸ› οΈ FastAPI, βœ”οΈ 🎁 🎭 πŸ•β” πŸ‘† βš™οΈ `Optional` βš–οΈ `Union[Something, None]` 🍡 πŸ”’ πŸ’², πŸ‘† πŸ’ͺ ✍ πŸŒ… πŸ”ƒ ⚫️ Pydantic 🩺 πŸ”ƒ <a href="https://docs.pydantic.dev/latest/concepts/models/#required-optional-fields" class="external-link" target="_blank">βœ” πŸ“¦ πŸ‘</a>.
    
    ///
    
    ### βš™οΈ Pydantic `Required` ↩️ ❕ (`...`)
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.7K bytes
    - Viewed (0)
  7. docs/de/docs/advanced/additional-responses.md

    Jedes dieser Response-`dict`s kann einen SchlΓΌssel `model` haben, welcher ein Pydantic-Modell enthΓ€lt, genau wie `response_model`.
    
    **FastAPI** nimmt dieses Modell, generiert dessen JSON-Schema und fΓΌgt es an der richtigen Stelle in OpenAPI ein.
    
    Um beispielsweise eine weitere Response mit dem Statuscode `404` und einem Pydantic-Modell `Message` zu deklarieren, kΓΆnnen Sie schreiben:
    
    ```Python hl_lines="18  22"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/additional-responses.md

    Each of those response `dict`s can have a key `model`, containing a Pydantic model, just like `response_model`.
    
    **FastAPI** will take that model, generate its JSON Schema and include it in the correct place in OpenAPI.
    
    For example, to declare another response with a status code `404` and a Pydantic model `Message`, you can write:
    
    {* ../../docs_src/additional_responses/tutorial001.py hl[18,22] *}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 16:07:07 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  9. docs_src/body_multiple_params/tutorial004.py

    from typing import Union
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Mar 10 18:49:18 UTC 2023
    - 653 bytes
    - Viewed (0)
  10. docs/ko/docs/advanced/response-directly.md

    ///
    
    그리고 `Response`λ₯Ό λ°˜ν™˜ν•˜λ©΄ **FastAPI**κ°€ 이λ₯Ό κ·ΈλŒ€λ‘œ μ „λ‹¬ν•©λ‹ˆλ‹€.
    
    Pydantic λͺ¨λΈλ‘œ 데이터 λ³€ν™˜μ„ μˆ˜ν–‰ν•˜μ§€ μ•ŠμœΌλ©°, λ‚΄μš©μ„ λ‹€λ₯Έ ν˜•μ‹μœΌλ‘œ λ³€ν™˜ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
    
    이둜 인해 λ§Žμ€ μœ μ—°μ„±μ„ 얻을 수 μžˆμŠ΅λ‹ˆλ‹€. μ–΄λ–€ 데이터 μœ ν˜•μ΄λ“  λ°˜ν™˜ν•  수 있고, 데이터 μ„ μ–Έμ΄λ‚˜ μœ νš¨μ„± 검사λ₯Ό μž¬μ •μ˜ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
    
    ## `Response`μ—μ„œ `jsonable_encoder` μ‚¬μš©ν•˜κΈ°
    
    **FastAPI**λŠ” λ°˜ν™˜ν•˜λŠ” `Response`에 μ•„λ¬΄λŸ° λ³€ν™˜μ„ ν•˜μ§€ μ•ŠμœΌλ―€λ‘œ, κ·Έ λ‚΄μš©μ΄ μ€€λΉ„λ˜μ–΄ μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.
    
    예λ₯Ό λ“€μ–΄, Pydantic λͺ¨λΈμ„ `dict`둜 λ³€ν™˜ν•΄ `JSONResponse`에 넣지 μ•ŠμœΌλ©΄ JSON ν˜Έν™˜ μœ ν˜•μœΌλ‘œ λ³€ν™˜λœ 데이터 μœ ν˜•(예: `datetime`, `UUID` λ“±)이 μ‚¬μš©λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 30 20:00:57 UTC 2024
    - 3.4K bytes
    - Viewed (0)
Back to top