- Sort Score
- Num 10 results
- Language All
Results 131 - 140 of 212 for BaseModel (0.63 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
tests/test_schema_compat_pydantic_v2.py
from inline_snapshot import snapshot from pydantic import BaseModel from tests.utils import needs_py310 @pytest.fixture(name="client") def get_client(): from enum import Enum app = FastAPI() class PlatformRole(str, Enum): admin = "admin" user = "user" class OtherRole(str, Enum): ... class User(BaseModel): username: str role: PlatformRole | OtherRole
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Mar 23 12:36:49 GMT 2026 - 4.1K bytes - Click Count (0) -
tests/test_tuples.py
from fastapi import FastAPI, Form from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() class ItemGroup(BaseModel): items: list[tuple[str, str]] class Coordinate(BaseModel): x: float y: float @app.post("/model-with-tuple/") def post_model_with_tuple(item_group: ItemGroup): return item_group
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 10.8K bytes - Click Count (0) -
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 Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Dec 16 12:34:01 GMT 2025 - 2.7K bytes - Click Count (0) -
tests/test_dependency_duplicates.py
from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() client = TestClient(app) class Item(BaseModel): data: str def duplicate_dependency(item: Item): return item def dependency(item2: Item): return item2 def sub_duplicate_dependency(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 8.8K bytes - Click Count (0) -
tests/test_response_by_alias.py
from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, ConfigDict, Field app = FastAPI() class Model(BaseModel): name: str = Field(alias="alias") class ModelNoAlias(BaseModel): name: str model_config = ConfigDict( json_schema_extra={ "description": (
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 11.7K bytes - Click Count (0) -
tests/test_serialize_response_model.py
from fastapi import FastAPI from pydantic import BaseModel, Field from starlette.testclient import TestClient app = FastAPI() class Item(BaseModel): name: str = Field(alias="aliased_name") price: float | None = None owner_ids: list[int] | None = None @app.get("/items/valid", response_model=Item) def get_valid(): return Item(aliased_name="valid", price=1.0) @app.get("/items/coerce", response_model=Item)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 4.1K bytes - Click Count (0) -
fastapi/security/http.py
from fastapi.security.base import SecurityBase from fastapi.security.utils import get_authorization_scheme_param from pydantic import BaseModel from starlette.requests import Request from starlette.status import HTTP_401_UNAUTHORIZED class HTTPBasicCredentials(BaseModel): """ The HTTP Basic credentials given as the result of using `HTTPBasic` in a dependency. Read more about it in the
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Mar 16 10:16:48 GMT 2026 - 13.1K bytes - Click Count (0) -
fastapi/sse.py
from typing import Annotated, Any from annotated_doc import Doc from pydantic import AfterValidator, BaseModel, Field, model_validator from starlette.responses import StreamingResponse # Canonical SSE event schema matching the OpenAPI 3.2 spec # (Section 4.14.4 "Special Considerations for Server-Sent Events") _SSE_EVENT_SCHEMA: dict[str, Any] = { "type": "object", "properties": { "data": {"type": "string"},
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 6.2K bytes - Click Count (0) -
tests/test_openapi_separate_input_output_schemas.py
from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, computed_field class SubItem(BaseModel): subname: str sub_description: str | None = None tags: list[str] = [] model_config = {"json_schema_serialization_defaults_required": True} class Item(BaseModel): name: str description: str | None = None sub: SubItem | None = None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 27.8K bytes - Click Count (0) -
tests/test_security_oauth2_optional.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 9.8K bytes - Click Count (0)