- Sort Score
- Num 10 results
- Language All
Results 221 - 230 of 844 for pydantic (0.1 seconds)
-
docs_src/extra_models/tutorial003_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class BaseItem(BaseModel): description: str type: str class CarItem(BaseItem): type: str = "car" class PlaneItem(BaseItem): type: str = "plane" size: int items = { "item1": {"description": "All my friends drive a low rider", "type": "car"}, "item2": {
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 612 bytes - Click Count (0) -
docs_src/server_sent_events/tutorial001_py310.py
from collections.abc import AsyncIterable, Iterable from fastapi import FastAPI from fastapi.sse import EventSourceResponse from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None items = [ Item(name="Plumbus", description="A multi-purpose household device."), Item(name="Portal Gun", description="A portal opening device."),
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 1.1K 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 Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 10 18:49:18 GMT 2023 - 603 bytes - Click Count (0) -
docs/en/docs/how-to/conditional-openapi.md
If you want to secure your API, there are several better things you can do, for example: * Make sure you have well defined Pydantic models for your request bodies and responses. * Configure any required permissions and roles using dependencies. * Never store plaintext passwords, only password hashes.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 2.4K bytes - Click Count (0) -
docs/ja/docs/tutorial/sql-databases.md
`SQLModel` をインポートしてデータベースモデルを作成します: {* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[1:11] hl[7:11] *} `Hero` クラスは Pydantic モデルによく似ています(実際には内部的に Pydantic モデルでもあります)。 いくつかの違いがあります: * `table=True` は SQLModel に対して「これはテーブルモデルであり、SQL データベースのテーブルを表す。単なるデータモデル(通常の Pydantic クラス)ではない」と伝えます。 * `Field(primary_key=True)` は `id` が SQL データベースのプライマリキーであることを SQLModel に伝えます(SQL のプライマリキーについては SQLModel ドキュメントを参照してください)。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 18K bytes - Click Count (0) -
tests/test_openapi_model_description_trim_on_formfeed.py
from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class MyModel(BaseModel): """ A model with a form feed character in the title. \f Text after form feed character. """ @app.get("/foo") def foo(v: MyModel): # pragma: no cover pass client = TestClient(app) def test_openapi():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Jun 17 07:46:27 GMT 2025 - 660 bytes - Click Count (0) -
tests/test_security_api_key_query_description.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyQuery from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyQuery(name="key", description="API Key Query") 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.2K bytes - Click Count (0) -
tests/test_dependency_after_yield_streaming.py
assert response.status_code == 500 assert response.text == "Internal Server Error" def test_broken_session_stream_raise(): # Can raise ValueError on Pydantic v2 and ExceptionGroup on Pydantic v1 with pytest.raises((ValueError, Exception)): client.get("/broken-session-stream") def test_broken_session_stream_no_raise(): """Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 3.2K bytes - Click Count (0) -
docs/zh-hant/docs/alternatives.md
我將 **FastAPI** 視為 APIStar 的「精神繼承者」,同時基於所有這些先前工具的經驗,改進並擴增了功能、型別系統與其他部分。 /// ## **FastAPI** 所採用的工具 { #used-by-fastapi } ### [Pydantic](https://docs.pydantic.dev/) { #pydantic } Pydantic 是基於 Python 型別提示,定義資料驗證、序列化與文件(使用 JSON Schema)的函式庫。 這讓它非常直覺。 它可與 Marshmallow 相提並論。儘管在效能測試中它比 Marshmallow 更快。而且因為它基於相同的 Python 型別提示,編輯器支援也很出色。 /// check | **FastAPI** 用於Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 20K bytes - Click Count (0) -
docs_src/app_testing/app_b_an_py310/main.py
from typing import Annotated from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel fake_secret_token = "coneofsilence" fake_db = { "foo": {"id": "foo", "title": "Foo", "description": "There goes my hero"}, "bar": {"id": "bar", "title": "Bar", "description": "The bartenders"}, } app = FastAPI() class Item(BaseModel): id: str title: str description: str | None = None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 13:32:24 GMT 2026 - 1.1K bytes - Click Count (0)