- Sort Score
- Num 10 results
- Language All
Results 171 - 180 of 286 for BaseModel (0.05 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs_src/body_updates/tutorial002_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 Dec 20 15:55:38 GMT 2025 - 1K bytes - Click Count (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()
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 12:54:56 GMT 2025 - 4.2K bytes - Click Count (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},
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 1.3K bytes - Click Count (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
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 2.7K bytes - Click Count (0) -
docs_src/python_types/tutorial012_py39.py
from typing import Optional from pydantic import BaseModel class User(BaseModel): name: str
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 122 bytes - Click Count (0) -
tests/test_security_openid_connect.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") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(oid)): user = User(username=oauth_header) return user
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Mon Nov 24 19:03:06 GMT 2025 - 2.3K bytes - Click Count (0) -
tests/test_inherited_custom_class.py
import uuid import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel class MyUuid: def __init__(self, uuid_string: str): self.uuid = uuid_string def __str__(self): return self.uuid @property # type: ignore def __class__(self): return uuid.UUID @property def __dict__(self):Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 12:54:56 GMT 2025 - 1.8K bytes - Click Count (0) -
tests/test_webhooks_security.py
from typing import Annotated from fastapi import FastAPI, Security from fastapi.security import HTTPBearer from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() bearer_scheme = HTTPBearer() class Subscription(BaseModel): username: str monthly_fee: float start_date: datetime @app.webhooks.post("new-subscription") def new_subscription(
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 4.5K bytes - Click Count (0) -
tests/test_request_params/test_query/test_optional_str.py
from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-str") async def read_optional_str(p: Optional[str] = None): return {"p": p} class QueryModelOptionalStr(BaseModel): p: Optional[str] = None @app.get("/model-optional-str")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 8.1K bytes - Click Count (0) -
tests/test_tuples.py
from fastapi import FastAPI, Form from fastapi.testclient import TestClient 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 @app.post("/tuple-of-models/")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 9.8K bytes - Click Count (0)