- Sort Score
- Result 10 results
- Languages All
Results 211 - 220 of 346 for BaseModel (0.04 sec)
-
docs_src/body_multiple_params/tutorial003_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 class User(BaseModel): username: str full_name: Union[str, None] = None @app.put("/items/{item_id}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 548 bytes - Viewed (0) -
tests/test_security_openid_connect_optional.py
from fastapi import Depends, FastAPI, Security from fastapi.security.open_id_connect_url import OpenIdConnect from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(oid)): if oauth_header is None: return None
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.4K bytes - Viewed (0) -
tests/test_custom_schema_fields.py
from typing import Annotated, Optional from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, WithJsonSchema app = FastAPI() class Item(BaseModel): name: str description: Annotated[ Optional[str], WithJsonSchema({"type": ["string", "null"]}) ] = None model_config = { "json_schema_extra": { "x-something-internal": {"level": 4},
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_compat.py
app = FastAPI() class Missing: def __bool__(self): return False class EmbeddedModel(BaseModel): model_config = ConfigDict(arbitrary_types_allowed=True) value: Union[str, Missing] = Missing() class Model(BaseModel): model_config = ConfigDict( arbitrary_types_allowed=True, ) value: Union[str, Missing] = Missing()
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 4.2K bytes - Viewed (0) -
tests/test_request_param_model_by_alias.py
from dirty_equals import IsPartialDict from fastapi import Cookie, FastAPI, Header, Query from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() class Model(BaseModel): param: str = Field(alias="param_alias") @app.get("/query") async def query_model(data: Model = Query()): return {"param": data.param} @app.get("/header") async def header_model(data: Model = Header()):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 2.1K bytes - Viewed (0) -
tests/test_additional_responses_custom_model_in_callback.py
from fastapi import APIRouter, FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, HttpUrl from starlette.responses import JSONResponse class CustomModel(BaseModel): a: int app = FastAPI() callback_router = APIRouter(default_response_class=JSONResponse) @callback_router.get( "{$callback_url}/callback/", responses={400: {"model": CustomModel}} )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 5.8K bytes - Viewed (0) -
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
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 2.7K bytes - Viewed (0) -
tests/test_arbitrary_types.py
import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot @pytest.fixture(name="client") def get_client(): from pydantic import ( BaseModel, ConfigDict, PlainSerializer, TypeAdapter, WithJsonSchema, ) class FakeNumpyArray: def __init__(self): self.data = [1.0, 2.0, 3.0]
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 3.8K bytes - Viewed (0) -
tests/test_request_params/test_body/test_optional_list.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-list-str", operation_id="optional_list_str") async def read_optional_list_str(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 12.7K bytes - Viewed (0) -
docs_src/security/tutorial003_an_py39.py
from typing import Annotated, Union 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)