- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 375 for BaseModel (0.05 sec)
-
docs_src/body_nested_models/tutorial005_py39.py
from typing import Union 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() image: Union[Image, None] = None @app.put("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 512 bytes - Viewed (0) -
fastapi/_compat.py
def _model_rebuild(model: Type[BaseModel]) -> None: model.model_rebuild() def _model_dump( model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any ) -> Any: return model.model_dump(mode=mode, **kwargs) def _get_model_config(model: BaseModel) -> Any: return model.model_config def get_schema_from_model_field(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Oct 12 09:36:32 UTC 2024 - 23.4K bytes - Viewed (0) -
docs_src/response_model/tutorial003_py310.py
from typing import Any from fastapi import FastAPI from pydantic import BaseModel, EmailStr app = FastAPI() class UserIn(BaseModel): username: str password: str email: EmailStr full_name: str | None = None class UserOut(BaseModel): username: str email: EmailStr full_name: str | None = None @app.post("/user/", response_model=UserOut) async def create_user(user: UserIn) -> Any:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jan 07 13:45:48 UTC 2023 - 431 bytes - Viewed (0) -
docs_src/body_nested_models/tutorial005.py
from typing import Set, Union 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() image: Union[Image, None] = None @app.put("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 517 bytes - Viewed (0) -
docs_src/body_nested_models/tutorial006_py39.py
from typing import Union 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 @app.put("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 519 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 Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 2K bytes - Viewed (0) -
docs_src/body_nested_models/tutorial006.py
from typing import List, Set, Union 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 @app.put("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 530 bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model/app_pv1.py
from typing import Optional from fastapi import Depends, FastAPI from pydantic import BaseModel, validator app = FastAPI() class ModelB(BaseModel): username: str class ModelC(ModelB): password: str class ModelA(BaseModel): name: str description: Optional[str] = None model_b: ModelB @validator("name") def lower_username(cls, name: str, values):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 784 bytes - Viewed (0) -
docs_src/response_model/tutorial003.py
from typing import Any, Union from fastapi import FastAPI from pydantic import BaseModel, EmailStr app = FastAPI() class UserIn(BaseModel): username: str password: str email: EmailStr full_name: Union[str, None] = None class UserOut(BaseModel): username: str email: EmailStr full_name: Union[str, None] = None @app.post("/user/", response_model=UserOut)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jan 07 13:45:48 UTC 2023 - 450 bytes - Viewed (0) -
docs_src/additional_responses/tutorial001.py
from fastapi import FastAPI from fastapi.responses import JSONResponse from pydantic import BaseModel class Item(BaseModel): id: str value: str class Message(BaseModel): message: str app = FastAPI() @app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}}) async def read_item(item_id: str): if item_id == "foo":
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 26 13:32:30 UTC 2022 - 506 bytes - Viewed (0)