- Sort Score
- Num 10 results
- Language All
Results 61 - 70 of 279 for BaseModel (0.04 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs_src/body_nested_models/tutorial006_py310.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: str | None = None price: float tax: float | None = None tags: set[str] = set() images: list[Image] | None = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 475 bytes - Click Count (0) -
docs_src/header_param_models/tutorial001_py39.py
from typing import Union from fastapi import FastAPI, Header from pydantic import BaseModel app = FastAPI() class CommonHeaders(BaseModel): 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 - 390 bytes - Click Count (0) -
docs_src/body_multiple_params/tutorial003_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None class User(BaseModel): username: str full_name: str | None = None @app.put("/items/{item_id}") async def update_item(
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 550 bytes - Click Count (0) -
docs_src/body_nested_models/tutorial004_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Image(BaseModel): url: str name: str class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: set[str] = set() image: Union[Image, None] = None @app.put("/items/{item_id}")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 499 bytes - Click Count (0) -
tests/test_response_model_default_factory.py
from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() class ResponseModel(BaseModel): code: int = 200 message: str = Field(default_factory=lambda: "Successful operation.") @app.get( "/response_model_has_default_factory_return_dict", response_model=ResponseModel, ) async def response_model_has_default_factory_return_dict():
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Sep 20 18:51:40 GMT 2025 - 1.2K bytes - Click Count (0) -
docs_src/path_operation_configuration/tutorial001_py39.py
from typing import Union from fastapi import FastAPI, status 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, status_code=status.HTTP_201_CREATED) async def create_item(item: Item):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 401 bytes - Click Count (0) -
fastapi/_compat/shared.py
from pydantic import v1 return isinstance(obj, v1.BaseModel) def is_pydantic_v1_model_class(cls: Any) -> bool: with warnings.catch_warnings(): warnings.simplefilter("ignore", UserWarning) from pydantic import v1 return lenient_issubclass(cls, v1.BaseModel) def annotation_is_pydantic_v1(annotation: Any) -> bool:Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 12:54:56 GMT 2025 - 6.7K bytes - Click Count (0) -
docs_src/body_multiple_params/tutorial004_py310.py
from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None class User(BaseModel): username: str full_name: str | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Item, user: User,
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Mar 10 18:49:18 GMT 2023 - 603 bytes - Click Count (0) -
docs_src/separate_openapi_schemas/tutorial001_py310.py
from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: str | None = None app = FastAPI() @app.post("/items/") def create_item(item: Item): return item @app.get("/items/") def read_items() -> list[Item]: return [ Item( name="Portal Gun", description="Device to travel through the multi-rick-verse",
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Aug 25 19:10:22 GMT 2023 - 451 bytes - Click Count (0) -
docs_src/body_multiple_params/tutorial005_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 @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item = Body(embed=True)): 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 - 407 bytes - Click Count (0)