- Sort Score
- Num 10 results
- Language All
Results 241 - 250 of 844 for pydantic (0.06 seconds)
-
docs/en/docs/project-generation.md
- ⚡ [**FastAPI**](https://fastapi.tiangolo.com) for the Python backend API. - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) for the Python SQL database interactions (ORM). - 🔍 [Pydantic](https://docs.pydantic.dev), used by FastAPI, for the data validation and settings management. - 💾 [PostgreSQL](https://www.postgresql.org) as the SQL database. - 🚀 [React](https://react.dev) for the frontend.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 1.9K bytes - Click Count (0) -
tests/test_security_openid_connect_optional.py
from fastapi import Depends, FastAPI, Security from fastapi.security.open_id_connect_url import OpenIdConnect from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: str | None = Security(oid)):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 2.6K bytes - Click Count (0) -
docs/ko/docs/tutorial/body-multiple-params.md
"tax": 3.2 } ``` 하지만, 다중 본문 매개변수 역시 선언할 수 있습니다. 예. `item`과 `user`: {* ../../docs_src/body_multiple_params/tutorial002_py310.py hl[20] *} 이 경우에, **FastAPI**는 이 함수에 본문 매개변수가 1개보다 많다는 것을 알아챌 것입니다(두 매개변수가 Pydantic 모델입니다). 그래서, 본문에서 매개변수 이름을 키(필드 이름)로 사용하고, 다음과 같은 본문을 예상합니다: ```JSON { "item": { "name": "Foo", "description": "The pretender", "price": 42.0, "tax": 3.2 },
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 14 08:57:01 GMT 2026 - 5.5K bytes - Click Count (0) -
tests/test_custom_schema_fields.py
from typing import Annotated from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, WithJsonSchema app = FastAPI() class Item(BaseModel): name: str description: Annotated[str | None, WithJsonSchema({"type": ["string", "null"]})] = ( None ) model_config = { "json_schema_extra": { "x-something-internal": {"level": 4}, }
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 1.3K bytes - Click Count (0) -
tests/test_security_api_key_cookie.py
from fastapi import Depends, FastAPI, Security 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") 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.1K bytes - Click Count (0) -
docs/zh/docs/how-to/conditional-openapi.md
如果你想保护你的 API,有很多更好的措施,例如: - 确保为请求体和响应定义完善的 Pydantic 模型。 - 使用依赖配置所需的权限和角色。 - 绝不要存储明文密码,只存储密码哈希。 - 实现并使用成熟的密码学工具,比如 pwdlib 和 JWT 令牌等。 - 在需要的地方使用 OAuth2 作用域添加更细粒度的权限控制。 - ...等。 尽管如此,你可能确实有非常特定的用例,需要在某些环境(例如生产环境)禁用 API 文档,或根据环境变量的配置来决定。 ## 基于设置和环境变量的条件式 OpenAPI { #conditional-openapi-from-settings-and-env-vars } 你可以很容易地使用相同的 Pydantic 设置来配置生成的 OpenAPI 和文档 UI。 例如:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 2.2K bytes - Click Count (0) -
tests/test_security_api_key_cookie_description.py
from fastapi import Depends, FastAPI, Security 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", description="An API Cookie Key") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2.3K bytes - Click Count (0) -
docs_src/openapi_callbacks/tutorial001_py310.py
from fastapi import APIRouter, FastAPI from pydantic import BaseModel, HttpUrl app = FastAPI() class Invoice(BaseModel): id: str title: str | None = None customer: str total: float class InvoiceEvent(BaseModel): description: str paid: bool class InvoiceEventReceived(BaseModel): ok: bool invoices_callback_router = APIRouter() @invoices_callback_router.post(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 1.3K bytes - Click Count (0) -
docs_src/body_nested_models/tutorial008_py310.py
from fastapi import FastAPI from pydantic import BaseModel, HttpUrl app = FastAPI() class Image(BaseModel): url: HttpUrl name: str @app.post("/images/multiple/") async def create_multiple_images(images: list[Image]):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 248 bytes - Click Count (0) -
tests/test_json_type.py
import json from typing import Annotated from fastapi import Cookie, FastAPI, Form, Header, Query from fastapi.testclient import TestClient from pydantic import Json app = FastAPI() @app.post("/form-json-list") def form_json_list(items: Annotated[Json[list[str]], Form()]) -> list[str]: return items @app.get("/query-json-list") def query_json_list(items: Annotated[Json[list[str]], Query()]) -> list[str]: return items
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 05 18:41:43 GMT 2026 - 1.7K bytes - Click Count (0)