- Sort Score
- Num 10 results
- Language All
Results 91 - 100 of 271 for BaseModel (0.07 seconds)
-
tests/test_security_api_key_query_description.py
from fastapi.security import APIKeyQuery from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyQuery(name="key", description="API Key Query") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2.2K bytes - Click Count (0) -
tests/test_request_params/test_header/test_optional_list.py
from inline_snapshot import snapshot from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-list-str") async def read_optional_list_str( p: Annotated[list[str] | None, Header()] = None, ): return {"p": p} class HeaderModelOptionalListStr(BaseModel): p: list[str] | None = None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 9.6K bytes - Click Count (0) -
tests/forward_reference_type.py
from pydantic import BaseModel def forwardref_method(input: "ForwardRefModel") -> "ForwardRefModel": return ForwardRefModel(x=input.x + 1) class ForwardRefModel(BaseModel):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Dec 02 17:23:14 GMT 2025 - 196 bytes - Click Count (0) -
tests/test_computed_fields.py
@pytest.fixture(name="client") def get_client(request): separate_input_output_schemas = request.param app = FastAPI(separate_input_output_schemas=separate_input_output_schemas) from pydantic import BaseModel, computed_field class Rectangle(BaseModel): width: int length: int @computed_field @property def area(self) -> int: return self.width * self.length @app.get("/")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 3.8K bytes - Click Count (0) -
docs_src/body_nested_models/tutorial004_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Image(BaseModel): url: str name: str class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None tags: set[str] = set() image: Image | None = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed May 11 17:29:02 GMT 2022 - 455 bytes - Click Count (0) -
tests/test_security_api_key_query_optional.py
from fastapi.security import APIKeyQuery from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyQuery(name="key", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: str | None = Security(api_key)): if oauth_header is None: return None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 2.1K bytes - Click Count (0) -
docs_src/app_testing/app_b_an_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 Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 13:32:24 GMT 2026 - 1.1K bytes - Click Count (0) -
docs_src/request_form_models/tutorial001_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 228 bytes - Click Count (0) -
tests/test_security_api_key_cookie_optional.py
from fastapi.security import APIKeyCookie from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyCookie(name="key", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: str | None = Security(api_key)): if oauth_header is None: return None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 2.2K bytes - Click Count (0) -
docs_src/request_form_models/tutorial001_an_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 268 bytes - Click Count (0)