- Sort Score
- Num 10 results
- Language All
Results 131 - 140 of 346 for BaseModel (0.06 seconds)
-
docs_src/security/tutorial002_py39.py
from typing import Union from fastapi import Depends, FastAPI from fastapi.security import OAuth2PasswordBearer from pydantic import BaseModel app = FastAPI() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") class User(BaseModel): username: str email: Union[str, None] = None full_name: Union[str, None] = None disabled: Union[bool, None] = None def fake_decode_token(token): return User(
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 755 bytes - Click Count (0) -
tests/test_schema_ref_pydantic_v2.py
import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, ConfigDict, Field @pytest.fixture(name="client") def get_client(): app = FastAPI() class ModelWithRef(BaseModel): ref: str = Field(validation_alias="$ref", serialization_alias="$ref")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 2.1K bytes - Click Count (0) -
docs_src/body_multiple_params/tutorial001_an_py39.py
from typing import Annotated, Union from fastapi import FastAPI, Path 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: Annotated[int, Path(title="The ID of the item to get", ge=0, le=1000)], q: Union[str, None] = None,
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 610 bytes - Click Count (0) -
docs_src/path_operation_advanced_configuration/tutorial004_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None tags: set[str] = set() @app.post("/items/", response_model=Item, summary="Create an item") async def create_item(item: Item): """ Create an item with all the information: - **name**: each item must have a name
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 674 bytes - Click Count (0) -
docs_src/path_operation_configuration/tutorial004_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: set[str] = set() @app.post("/items/", response_model=Item, summary="Create an item") async def create_item(item: Item): """ Create an item with all the information:
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 676 bytes - Click Count (0) -
tests/test_request_params/test_header/test_optional_list.py
from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-list-str") async def read_optional_list_str( p: Annotated[Optional[list[str]], Header()] = None, ): return {"p": p} class HeaderModelOptionalListStr(BaseModel): p: Optional[list[str]] = None
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 9.3K bytes - Click Count (0) -
docs_src/body_nested_models/tutorial007_py39.py
from fastapi import FastAPI from pydantic import BaseModel, HttpUrl app = FastAPI() class Image(BaseModel): url: HttpUrl name: str class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: set[str] = set() images: Union[list[Image], None] = None class Offer(BaseModel): name: str
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 570 bytes - Click Count (0) -
tests/test_request_params/test_header/test_required_str.py
from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/required-str") async def read_required_str(p: Annotated[str, Header()]): return {"p": p} class HeaderModelRequiredStr(BaseModel): p: str @app.get("/model-required-str")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 10K bytes - Click Count (0) -
docs_src/extra_models/tutorial002_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel, EmailStr app = FastAPI() class UserBase(BaseModel): username: str email: EmailStr full_name: Union[str, None] = None class UserIn(UserBase): password: str class UserOut(UserBase): pass class UserInDB(UserBase): hashed_password: str def fake_password_hasher(raw_password: str):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 830 bytes - Click Count (0) -
docs_src/response_model/tutorial006_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: float = 10.5 items = { "foo": {"name": "Foo", "price": 50.2}, "bar": {"name": "Bar", "description": "The Bar fighters", "price": 62, "tax": 20.2}, "baz": { "name": "Baz",
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 848 bytes - Click Count (0)