- Sort Score
- Result 10 results
- Languages All
Results 51 - 60 of 346 for BaseModel (0.07 sec)
-
docs_src/body_fields/tutorial001_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str description: str | None = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: float | None = None @app.put("/items/{item_id}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 563 bytes - Viewed (0) -
tests/test_additional_responses_response_class.py
from fastapi.responses import JSONResponse from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: list[Error] @app.get( "/a", response_class=JsonApiResponse,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 3.5K bytes - Viewed (0) -
tests/test_skip_defaults.py
from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class SubModel(BaseModel): a: Optional[str] = "foo" class Model(BaseModel): x: Optional[int] = None sub: SubModel class ModelSubclass(Model): y: int z: int = 0 w: Optional[int] = None class ModelDefaults(BaseModel): w: Optional[str] = None x: Optional[str] = None
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 2K bytes - Viewed (0) -
tests/test_response_model_include_exclude.py
from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel class Model1(BaseModel): foo: str bar: str class Model2(BaseModel): ref: Model1 baz: str class Model3(BaseModel): name: str age: int ref2: Model2 app = FastAPI() @app.get( "/simple_include", response_model=Model2,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Jul 19 19:14:58 UTC 2021 - 4K bytes - Viewed (0) -
tests/test_datetime_custom_encoder.py
from datetime import datetime, timezone from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel def test_pydanticv2(): from pydantic import field_serializer class ModelWithDatetimeField(BaseModel): dt_field: datetime @field_serializer("dt_field") def serialize_datetime(self, dt_field: datetime):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 817 bytes - Viewed (0) -
docs_src/body_multiple_params/tutorial001_py39.py
from typing import 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: int = Path(title="The ID of the item to get", ge=0, le=1000), q: Union[str, None] = None,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 596 bytes - Viewed (0) -
docs_src/path_operation_advanced_configuration/tutorial007_pv1_py39.py
import yaml from fastapi import FastAPI, HTTPException, Request from pydantic.v1 import BaseModel, ValidationError app = FastAPI() class Item(BaseModel): name: str tags: list[str] @app.post( "/items/", openapi_extra={ "requestBody": { "content": {"application/x-yaml": {"schema": Item.schema()}}, "required": True, }, }, )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 767 bytes - Viewed (0) -
docs_src/path_operation_advanced_configuration/tutorial007_py39.py
import yaml from fastapi import FastAPI, HTTPException, Request from pydantic import BaseModel, ValidationError app = FastAPI() class Item(BaseModel): name: str tags: list[str] @app.post( "/items/", openapi_extra={ "requestBody": { "content": {"application/x-yaml": {"schema": Item.model_json_schema()}}, "required": True, }, }, )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 797 bytes - Viewed (0) -
docs_src/request_form_models/tutorial001_py39.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 228 bytes - Viewed (0) -
docs_src/security/tutorial004_an_py39.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 02:57:38 UTC 2025 - 4.2K bytes - Viewed (0)