- Sort Score
- Num 10 results
- Language All
Results 51 - 60 of 349 for unionOf (0.05 seconds)
-
tests/test_compat.py
value: Union[str, Missing] = Missing() class Model(BaseModel): model_config = ConfigDict( arbitrary_types_allowed=True, ) value: Union[str, Missing] = Missing() embedded_model: EmbeddedModel = EmbeddedModel() @app.post("/") def foo(req: Model) -> dict[str, Union[str, None]]: return {
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) -
docs_src/path_operation_configuration/tutorial005_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", response_description="The created item", )
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 736 bytes - Click Count (0) -
docs_src/websockets/tutorial002_an_py39.py
</body> </html> """ @app.get("/") async def get(): return HTMLResponse(html) async def get_cookie_or_token( websocket: WebSocket, session: Annotated[Union[str, None], Cookie()] = None, token: Annotated[Union[str, None], Query()] = None, ): if session is None and token is None: raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION) return session or token
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 2.8K bytes - Click Count (0) -
docs_src/cookie_param_models/tutorial001_py39.py
from typing import Union from fastapi import Cookie, FastAPI from pydantic import BaseModel app = FastAPI() class Cookies(BaseModel): session_id: str fatebook_tracker: Union[str, None] = None googall_tracker: Union[str, None] = None @app.get("/items/") async def read_items(cookies: Cookies = Cookie()):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 341 bytes - Click Count (0) -
fastapi/types.py
import types from enum import Enum from typing import Any, Callable, Optional, TypeVar, Union from pydantic import BaseModel DecoratedCallable = TypeVar("DecoratedCallable", bound=Callable[..., Any]) UnionType = getattr(types, "UnionType", Union) ModelNameMap = dict[Union[type[BaseModel], type[Enum]], str] IncEx = Union[set[int], set[str], dict[int, Any], dict[str, Any]]
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 455 bytes - Click Count (0) -
docs_src/header_param_models/tutorial002_py39.py
from typing import Union from fastapi import FastAPI, Header from pydantic import BaseModel app = FastAPI() class CommonHeaders(BaseModel): model_config = {"extra": "forbid"} host: str save_data: bool if_modified_since: Union[str, None] = None traceparent: Union[str, None] = None x_tag: list[str] = [] @app.get("/items/") async def read_items(headers: CommonHeaders = Header()):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 430 bytes - Click Count (0) -
docs_src/body_nested_models/tutorial001_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: list = [] @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item): results = {"item_id": item_id, "item": item}
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 402 bytes - Click Count (0) -
docs_src/header_param_models/tutorial002_an_py39.py
from typing import Annotated, Union from fastapi import FastAPI, Header from pydantic import BaseModel app = FastAPI() class CommonHeaders(BaseModel): model_config = {"extra": "forbid"} host: str save_data: bool if_modified_since: Union[str, None] = None traceparent: Union[str, None] = None x_tag: list[str] = [] @app.get("/items/")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Sep 17 18:54:10 GMT 2024 - 451 bytes - Click Count (0) -
docs_src/body/tutorial004_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None app = FastAPI() @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item, q: Union[str, None] = None): result = {"item_id": item_id, **item.model_dump()} if q:
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 458 bytes - Click Count (0) -
docs_src/sql_databases/tutorial002_py39.py
from typing import Union from fastapi import Depends, FastAPI, HTTPException, Query from sqlmodel import Field, Session, SQLModel, create_engine, select class HeroBase(SQLModel): name: str = Field(index=True) age: Union[int, None] = Field(default=None, index=True) class Hero(HeroBase, table=True): id: Union[int, None] = Field(default=None, primary_key=True) secret_name: str class HeroPublic(HeroBase):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Oct 09 19:44:42 GMT 2024 - 2.6K bytes - Click Count (0)