Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 20 for json_schema_extra (0.49 seconds)

  1. fastapi/params.py

                deprecated=deprecated,
                example=example,
                examples=examples,
                openapi_examples=openapi_examples,
                include_in_schema=include_in_schema,
                json_schema_extra=json_schema_extra,
                **extra,
            )
    
    
    class Query(Param):  # type: ignore[misc]  # ty: ignore[unused-ignore-comment]
        in_ = ParamTypes.query
    
        def __init__(
            self,
    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)
  2. fastapi/param_functions.py

            example=example,
            examples=examples,
            openapi_examples=openapi_examples,
            deprecated=deprecated,
            include_in_schema=include_in_schema,
            json_schema_extra=json_schema_extra,
            **extra,
        )
    
    
    def Query(  # noqa: N802
        default: Annotated[
            Any,
            Doc(
                """
                Default value if the parameter field is not set.
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 68K bytes
    - Click Count (0)
  3. 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)
  4. 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)
  5. 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)
  6. fastapi/security/oauth2.py

                    """
                ),
            ],
            password: Annotated[
                str,
                Form(json_schema_extra={"format": "password"}),
                Doc(
                    """
                    `password` string. The OAuth2 spec requires the exact field name
                    `password`.
    
                    Read more about it in the
    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)
  7. 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)
  8. 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)
  9. 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)
  10. fastapi/_compat/v2.py

        "title": None,
        "field_title_generator": None,
        "description": None,
        "examples": None,
        "exclude": None,
        "exclude_if": None,
        "discriminator": None,
        "deprecated": None,
        "json_schema_extra": None,
        "frozen": None,
        "validate_default": None,
        "repr": True,
        "init": None,
        "init_var": None,
        "kw_only": None,
    }
    
    
    # TODO: remove when dropping support for Pydantic < v2.12.3
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 16.7K bytes
    - Click Count (0)
Back to Top