Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 221 - 230 of 286 for BaseModel (0.05 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. tests/test_filter_pydantic_sub_model_pv2.py

    from inline_snapshot import snapshot
    
    
    @pytest.fixture(name="client")
    def get_client():
        from pydantic import BaseModel, ValidationInfo, field_validator
    
        app = FastAPI()
    
        class ModelB(BaseModel):
            username: str
    
        class ModelC(ModelB):
            password: str
    
        class ModelA(BaseModel):
            name: str
            description: Optional[str] = None
            foo: ModelB
            tags: dict[str, str] = {}
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 6.6K bytes
    - Click Count (0)
  2. docs_src/body_updates/tutorial001_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Union[str, None] = None
        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: list[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 900 bytes
    - Click Count (0)
  3. scripts/topic_repos.py

    import secrets
    import subprocess
    from pathlib import Path
    
    import yaml
    from github import Github
    from pydantic import BaseModel, SecretStr
    from pydantic_settings import BaseSettings
    
    
    class Settings(BaseSettings):
        github_repository: str
        github_token: SecretStr
    
    
    class Repo(BaseModel):
        name: str
        html_url: str
        stars: int
        owner_login: str
        owner_html_url: str
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Dec 16 12:34:01 GMT 2025
    - 2.7K bytes
    - Click Count (0)
  4. docs_src/schema_extra_example/tutorial005_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
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Annotated[
            Item,
            Body(
                openapi_examples={
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Aug 26 18:03:13 GMT 2023
    - 1.5K bytes
    - Click Count (0)
  5. docs_src/schema_extra_example/tutorial005_py39.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
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item = Body(
            openapi_examples={
                "normal": {
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 1.4K bytes
    - Click Count (0)
  6. docs_src/app_testing/app_b_py310/main.py

    from fastapi import FastAPI, Header, HTTPException
    from pydantic import BaseModel
    
    fake_secret_token = "coneofsilence"
    
    fake_db = {
        "foo": {"id": "foo", "title": "Foo", "description": "There goes my hero"},
        "bar": {"id": "bar", "title": "Bar", "description": "The bartenders"},
    }
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        id: str
        title: str
        description: str | None = None
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Jan 09 14:44:08 GMT 2024
    - 1.1K bytes
    - Click Count (0)
  7. docs_src/app_testing/app_b_py39/main.py

    from fastapi import FastAPI, Header, HTTPException
    from pydantic import BaseModel
    
    fake_secret_token = "coneofsilence"
    
    fake_db = {
        "foo": {"id": "foo", "title": "Foo", "description": "There goes my hero"},
        "bar": {"id": "bar", "title": "Bar", "description": "The bartenders"},
    }
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        id: str
        title: str
        description: Union[str, None] = None
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 1.1K bytes
    - Click Count (0)
  8. schema/model_test.go

    	DeletedAt    *mytime
    	Active       mybool
    	Admin        *mybool
    }
    
    type BaseModel struct {
    	ID        uint
    	CreatedAt time.Time
    	CreatedBy *int
    	Created   *VersionUser `gorm:"foreignKey:CreatedBy"`
    	UpdatedAt time.Time
    	DeletedAt gorm.DeletedAt `gorm:"index"`
    }
    
    type VersionModel struct {
    	BaseModel
    	Version int
    }
    
    type VersionUser struct {
    	VersionModel
    	Name     string
    Created: Sun Dec 28 09:35:17 GMT 2025
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Click Count (0)
  9. 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
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:31:34 GMT 2025
    - 11.9K bytes
    - Click Count (0)
  10. 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")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 11.6K bytes
    - Click Count (0)
Back to Top