- Sort Score
- Num 10 results
- Language All
Results 101 - 110 of 844 for pydantic (0.21 seconds)
-
fastapi/sse.py
from typing import Annotated, Any from annotated_doc import Doc from pydantic import AfterValidator, BaseModel, Field, model_validator from starlette.responses import StreamingResponse # Canonical SSE event schema matching the OpenAPI 3.2 spec # (Section 4.14.4 "Special Considerations for Server-Sent Events") _SSE_EVENT_SCHEMA: dict[str, Any] = { "type": "object", "properties": { "data": {"type": "string"},
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 6.2K bytes - Click Count (0) -
docs/en/docs/tutorial/security/get-current-user.md
But that is still not that useful. Let's make it give us the current user. ## Create a user model { #create-a-user-model } First, let's create a Pydantic user model. The same way we use Pydantic to declare bodies, we can use it anywhere else: {* ../../docs_src/security/tutorial002_an_py310.py hl[5,12:6] *} ## Create a `get_current_user` dependency { #create-a-get-current-user-dependency }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 4K bytes - Click Count (0) -
docs_src/custom_response/tutorial006c_py310.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/pydantic", response_class=RedirectResponse, status_code=302) async def redirect_pydantic():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 237 bytes - Click Count (0) -
docs/en/docs/advanced/custom-response.md
type (`application/json`), like is the case with the `JSONResponse`, the data you return will be automatically converted (and filtered) with any Pydantic `response_model` that you declared in the *path operation decorator*. But the data won't be serialized to JSON bytes with Pydantic, instead it will be converted with the `jsonable_encoder` and then passed to the `JSONResponse` class, which will serialize it to bytes using the standard JSON library in Python. ### JSON Performance { #json-performance...
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 11K bytes - Click Count (0) -
docs/ja/docs/tutorial/body-updates.md
また、多くのチームは部分的な更新であっても`PUT`だけを使用しています。 **FastAPI** はどんな制限も課けていないので、それらを使うのは **自由** です。 しかし、このガイドでは、それらがどのように使用されることを意図しているかを多かれ少なかれ、示しています。 /// ### Pydanticの`exclude_unset`パラメータの使用 { #using-pydantics-exclude-unset-parameter } 部分的な更新を受け取りたい場合は、Pydanticモデルの`.model_dump()`の`exclude_unset`パラメータを使用すると非常に便利です。 `item.model_dump(exclude_unset=True)`のように。 これにより、`item`モデルの作成時に設定されたデータのみを持つ`dict`が生成され、デフォルト値は除外されます。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 5.2K bytes - Click Count (0) -
fastapi/.agents/skills/fastapi/references/streaming.md
Plain objects are automatically JSON-serialized as `data:` fields, declare the return type so the serialization is done by Pydantic: ```python from collections.abc import AsyncIterable from fastapi import FastAPI from fastapi.sse import EventSourceResponse from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str price: float
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 10:05:57 GMT 2026 - 2.5K bytes - Click Count (0) -
docs/ko/docs/tutorial/security/get-current-user.md
`get_current_user`는 우리가 만든 (가짜) 유틸리티 함수를 사용합니다. 이 함수는 `str`로 토큰을 받아 Pydantic `User` 모델을 반환합니다: {* ../../docs_src/security/tutorial002_an_py310.py hl[19:22,26:27] *} ## 현재 사용자 주입하기 { #inject-the-current-user } 이제 *경로 처리*에서 `get_current_user`와 함께 같은 `Depends`를 사용할 수 있습니다: {* ../../docs_src/security/tutorial002_an_py310.py hl[31] *} `current_user`의 타입을 Pydantic 모델 `User`로 선언한다는 점에 주목하세요. 이는 함수 내부에서 자동 완성과 타입 체크에 도움을 줍니다.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 14 08:57:01 GMT 2026 - 4.9K bytes - Click Count (0) -
docs/zh/docs/deployment/versions.md
你不应该固定`starlette`的版本。 不同版本的 **FastAPI** 将使用特定的较新版本的 Starlette。 因此,**FastAPI** 自己可以使用正确的 Starlette 版本。 ## 关于 Pydantic { #about-pydantic } Pydantic 包含针对 **FastAPI** 的测试及其自己的测试,因此 Pydantic 的新版本(`1.0.0`以上)始终与 FastAPI 兼容。 你可以将 Pydantic 固定到任何高于 `1.0.0` 且适合你的版本。 例如: ```txt pydantic>=2.7.0,<3.0.0Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 3.2K bytes - Click Count (0) -
docs/zh/docs/index.md
### 其他可选依赖 { #additional-optional-dependencies } 还有一些你可能想安装的可选依赖。 额外的 Pydantic 可选依赖: * [`pydantic-settings`](https://docs.pydantic.dev/latest/usage/pydantic_settings/) - 用于配置管理。 * [`pydantic-extra-types`](https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/) - 用于在 Pydantic 中使用的额外类型。 额外的 FastAPI 可选依赖: * [`orjson`](https://github.com/ijl/orjson) - 使用 `ORJSONResponse` 时需要。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 20.7K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/schema-extra-example.md
你可以宣告你的應用程式可接收資料的 examples。 以下有數種方式可達成。 ## Pydantic 模型中的額外 JSON Schema 資料 { #extra-json-schema-data-in-pydantic-models } 你可以為 Pydantic 模型宣告 `examples`,它們會加入到產生出的 JSON Schema 中。 {* ../../docs_src/schema_extra_example/tutorial001_py310.py hl[13:24] *} 這些額外資訊會原封不動加入該模型輸出的 JSON Schema,並且會用在 API 文件裡。 你可以使用屬性 `model_config`(接收一個 `dict`),詳見 [Pydantic 文件:Configuration](https://docs.pydantic.dev/latest/api/config/)。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 8.4K bytes - Click Count (0)