Search Options

Results per page
Sort
Preferred Languages
Advance

Results 291 - 300 of 346 for BaseModel (0.05 sec)

  1. tests/test_request_params/test_body/test_list.py

    from typing import Annotated, Union
    
    import pytest
    from dirty_equals import IsOneOf, IsPartialDict
    from fastapi import Body, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 11.9K bytes
    - Viewed (0)
  2. tests/test_request_params/test_body/test_optional_str.py

    from typing import Annotated, Optional
    
    import pytest
    from fastapi import Body, FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-str", operation_id="optional_str")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 11.6K bytes
    - Viewed (0)
  3. docs_src/security/tutorial003_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from pydantic import BaseModel
    
    fake_users_db = {
        "johndoe": {
            "username": "johndoe",
            "full_name": "John Doe",
            "email": "******@****.***",
            "hashed_password": "fakehashedsecret",
            "disabled": False,
        },
        "alice": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 24 19:03:06 UTC 2025
    - 2.5K bytes
    - Viewed (0)
  4. scripts/label_approved.py

    import logging
    from typing import Literal
    
    from github import Github
    from github.PullRequestReview import PullRequestReview
    from pydantic import BaseModel, SecretStr
    from pydantic_settings import BaseSettings
    
    
    class LabelSettings(BaseModel):
        await_label: str | None = None
        number: int
    
    
    default_config = {"approved-2": LabelSettings(await_label="awaiting-review", number=2)}
    
    
    class Settings(BaseSettings):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Jun 17 07:50:19 UTC 2025
    - 2.2K bytes
    - Viewed (0)
  5. docs/fr/docs/tutorial/body.md

    ///
    
    ## Importez le `BaseModel` de Pydantic
    
    Commencez par importer la classe `BaseModel` du module `pydantic` :
    
    {* ../../docs_src/body/tutorial001.py hl[4] *}
    
    ## Créez votre modèle de données
    
    Déclarez ensuite votre modèle de données en tant que classe qui hérite de `BaseModel`.
    
    Utilisez les types Python standard pour tous les attributs :
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Nov 09 16:39:20 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  6. tests/test_response_model_sub_types.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    
    class Model(BaseModel):
        name: str
    
    
    app = FastAPI()
    
    
    @app.get("/valid1", responses={"500": {"model": int}})
    def valid1():
        pass
    
    
    @app.get("/valid2", responses={"500": {"model": list[int]}})
    def valid2():
        pass
    
    
    @app.get("/valid3", responses={"500": {"model": Model}})
    def valid3():
        pass
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  7. fastapi/openapi/models.py

    class Server(BaseModelWithConfig):
        url: Union[AnyUrl, str]
        description: Optional[str] = None
        variables: Optional[dict[str, ServerVariable]] = None
    
    
    class Reference(BaseModel):
        ref: str = Field(alias="$ref")
    
    
    class Discriminator(BaseModel):
        propertyName: str
        mapping: Optional[dict[str, str]] = None
    
    
    class XML(BaseModelWithConfig):
        name: Optional[str] = None
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 15.1K bytes
    - Viewed (0)
  8. tests/test_router_events.py

    from contextlib import asynccontextmanager
    from typing import Union
    
    import pytest
    from fastapi import APIRouter, FastAPI, Request
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    
    class State(BaseModel):
        app_startup: bool = False
        app_shutdown: bool = False
        router_startup: bool = False
        router_shutdown: bool = False
        sub_router_startup: bool = False
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  9. fastapi/exceptions.py

                    """
                ),
            ] = None,
        ) -> None:
            super().__init__(code=code, reason=reason)
    
    
    RequestErrorModel: type[BaseModel] = create_model("Request")
    WebSocketErrorModel: type[BaseModel] = create_model("WebSocket")
    
    
    class FastAPIError(RuntimeError):
        """
        A generic, FastAPI-specific error.
        """
    
    
    class DependencyScopeError(FastAPIError):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 6.8K bytes
    - Viewed (0)
  10. tests/test_multi_body_errors.py

    from decimal import Decimal
    
    from dirty_equals import IsOneOf
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from pydantic import BaseModel, condecimal
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        age: condecimal(gt=Decimal(0.0))  # type: ignore
    
    
    @app.post("/items/")
    def save_item_no_body(item: list[Item]):
        return {"item": item}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.1K bytes
    - Viewed (0)
Back to top