- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 21 for json_schema_extra (0.23 seconds)
-
fastapi/params.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 25.7K bytes - Click Count (0) -
fastapi/param_functions.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 68K bytes - Click Count (0) -
docs_src/schema_extra_example/tutorial001_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 646 bytes - Click Count (0) -
tests/test_custom_schema_fields.py
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}, } } @app.get("/foo", response_model=Item) def foo(): return {"name": "Foo item"} client = TestClient(app)
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_response_by_alias.py
app = FastAPI() class Model(BaseModel): name: str = Field(alias="alias") class ModelNoAlias(BaseModel): name: str model_config = ConfigDict( json_schema_extra={ "description": ( "response_model_by_alias=False is basically a quick hack, to support " "proper OpenAPI use another model with the correct field names" )
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 11.7K bytes - Click Count (0) -
docs/en/docs/tutorial/schema-extra-example.md
You can use the attribute `model_config` that takes a `dict` as described in [Pydantic's docs: Configuration](https://docs.pydantic.dev/latest/api/config/). You can set `"json_schema_extra"` with a `dict` containing any additional data you would like to show up in the generated JSON Schema, including `examples`. /// tip
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 8.7K bytes - Click Count (0) -
fastapi/security/oauth2.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Mar 24 16:32:10 GMT 2026 - 23.6K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/schema-extra-example.md
這些額外資訊會原封不動加入該模型輸出的 JSON Schema,並且會用在 API 文件裡。 你可以使用屬性 `model_config`(接收一個 `dict`),詳見 [Pydantic 文件:Configuration](https://docs.pydantic.dev/latest/api/config/)。 你可以將 `"json_schema_extra"` 設為一個 `dict`,其中包含你想在產生的 JSON Schema 中出現的任何額外資料,包括 `examples`。 /// tip 你可以用相同技巧擴充 JSON Schema,加入你自己的自訂額外資訊。 例如,你可以用它為前端使用者介面新增中繼資料等。 /// /// info
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) -
tests/test_schema_extra_examples.py
from pydantic import BaseModel, ConfigDict def create_app(): app = FastAPI() class Item(BaseModel): data: str model_config = ConfigDict( json_schema_extra={"example": {"data": "Data in schema_extra"}} ) @app.post("/schema_extra/") def schema_extra(item: Item): return item with pytest.warns(FastAPIDeprecationWarning):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 34.7K bytes - Click Count (0) -
docs/zh/docs/tutorial/schema-extra-example.md
这些额外信息会原样添加到该模型输出的 JSON Schema 中,并会在 API 文档中使用。 你可以使用属性 `model_config`,它接收一个 `dict`,详见 [Pydantic 文档:配置](https://docs.pydantic.dev/latest/api/config/)。 你可以设置 `"json_schema_extra"`,其值为一个 `dict`,包含你希望出现在生成 JSON Schema 中的任意附加数据,包括 `examples`。 /// tip | 提示 你也可以用同样的技巧扩展 JSON Schema,添加你自己的自定义额外信息。 例如,你可以用它为前端用户界面添加元数据等。 /// /// info | 信息
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 8.5K bytes - Click Count (0)