โ† eval4_submission_v1b

fastapi_14605

failed WRONG_FIX wrong_fix ยท 34 tool calls ยท 255 s ยท fastapi/fastapi

Task input

๐Ÿ”Š Add a custom `FastAPIDeprecationWarning`

๐Ÿ”Š Add a custom `FastAPIDeprecationWarning` and use it for deprecated logic, like Pydantic v1 models.

Motivated by: https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries

Tool calls (35)

#ToolArgumentsResult
1run_command
{
 "command": "grep -rn \"DeprecationWarning\" fastapi | head -20"
}
{"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:66: category=DeprecationWarning,
full
{"status": "ok", "stdout": "fastapi/dependencies/utils.py:330:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:66:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:96:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:506:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:536:                category=DeprecationWarning,\nfastapi/routing.py:643:                    category=DeprecationWarning,\nfastapi/routing.py:683:                        category=DeprecationWarning,\nfastapi/utils.py:200:        DeprecationWarning,\nfastapi/params.py:78:                category=DeprecationWarning,\nfastapi/params.py:108:                category=DeprecationWarning,\nfastapi/params.py:533:                category=DeprecationWarning,\nfastapi/params.py:563:                category=DeprecationWarning,\nfastapi/openapi/utils.py:220:        DeprecationWarning,\n", "exit_code": 0}
2run_command
{
 "command": "grep -rn \"pydantic.v1\" fastapi | head -20"
}
{"status": "ok", "stdout": "fastapi/dependencies/utils.py:47:from fastapi._compat.shared import annotation_is_pydantic_v1\nfastapi/dependencies/utils.py:75:from
full
{"status": "ok", "stdout": "fastapi/dependencies/utils.py:47:from fastapi._compat.shared import annotation_is_pydantic_v1\nfastapi/dependencies/utils.py:75:from .. import temp_pydantic_v1_params\nfastapi/dependencies/utils.py:328:                \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\nfastapi/dependencies/utils.py:334:            param_details.field.field_info, (params.Body, temp_pydantic_v1_params.Body)\nfastapi/dependencies/utils.py:403:                    temp_pydantic_v1_params.Param,\nfastapi/dependencies/utils.py:405:                    temp_pydantic_v1_params.Body,\nfastapi/dependencies/utils.py:494:            if annotation_is_pydantic_v1(use_annotation):\nfastapi/dependencies/utils.py:495:                field_info = temp_pydantic_v1_params.Body(  # type: ignore[assignment]\nfastapi/dependencies/utils.py:511:                field_info, (params.Path, temp_pydantic_v1_params.Path)\nfastapi/dependencies/utils.py:517:            isinstance(field_info, (params.Param, temp_pydantic_v1_params.Param))\nfastapi/dependencies/utils.py:526:        if isinstance(field_info, (params.Form, temp_pydantic_v1_params.Form)):\nfastapi/dependencies/utils.py:546:        elif isinstance(field_info, (params.Query, temp_pydantic_v1_params.Query)):\nfastapi/dependencies/utils.py:765:            isinstance(field.field_info, (params.Form, temp_pydantic_v1_params.Form))\nfastapi/dependencies/utils.py:835:        assert isinstance(field_info, (params.Param, temp_pydantic_v1_params.Param)), (\nfastapi/dependencies/utils.py:847:        assert isinstance(field_info, (params.Param, temp_pydantic_v1_params.Param)), (\nfastapi/dependencies/utils.py:896:        isinstance(first_field.field_info, (params.Form, temp_pydantic_v1_params.Form))\nfastapi/dependencies/utils.py:914:            isinstance(field_info, (params.File, temp_pydantic_v1_params.File))\nfastapi/dependencies/utils.py:921:            and isinstance(field_info, (params.File, temp_pydantic_v1_
3run_command
{
 "command": "grep -rn \"FastAPIDeprecationWarning\" fastapi"
}
{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "", "exit_code": 1}}
full
{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "", "exit_code": 1}}
4read_file
{
 "filepath": "fastapi/exceptions.py"
}
{"status": "ok", "filepath": "fastapi/exceptions.py", "content": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict,
full
{"status": "ok", "filepath": "fastapi/exceptions.py", "content": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, Union\n\nfrom annotated_doc import Doc\nfrom pydantic import BaseModel, create_model\nfrom starlette.exceptions import HTTPException as StarletteHTTPException\nfrom starlette.exceptions import WebSocketException as StarletteWebSocketException\n\n\nclass EndpointContext(TypedDict, total=False):\n    function: str\n    path: str\n    file: str\n    line: int\n\n\nclass HTTPException(StarletteHTTPException):\n    \"\"\"\n    An HTTP exception you can raise in your own code to show errors to the client.\n\n    This is for client errors, invalid authentication, invalid data, etc. Not for server\n    errors in your code.\n\n    Read more about it in the\n    [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).\n\n    ## Example\n\n    ```python\n    from fastapi import FastAPI, HTTPException\n\n    app = FastAPI()\n\n    items = {\"foo\": \"The Foo Wrestlers\"}\n\n\n    @app.get(\"/items/{item_id}\")\n    async def read_item(item_id: str):\n        if item_id not in items:\n            raise HTTPException(status_code=404, detail=\"Item not found\")\n        return {\"item\": items[item_id]}\n    ```\n    \"\"\"\n\n    def __init__(\n        self,\n        status_code: Annotated[\n            int,\n            Doc(\n                \"\"\"\n                HTTP status code to send to the client.\n                \"\"\"\n            ),\n        ],\n        detail: Annotated[\n            Any,\n            Doc(\n                \"\"\"\n                Any data to be sent to the client in the `detail` key of the JSON\n                response.\n                \"\"\"\n            ),\n        ] = None,\n        headers: Annotated[\n            Optional[dict[str, str]],\n            Doc(\n                \"\"\"\n                Any headers to send to the client in the response.\n    
5edit_file
{
 "filepath": "fastapi/exceptions.py",
 "new_string": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, Union\n\nfrom annotated_doc import Doc\nfrom pydantic import BaseModel, create_model\nfrom starlette.exceptions import HTTPException as StarletteHTTPException\nfrom starlette.exceptions import WebSocketException as StarletteWebSocketException\n\n\nclass FastAPIDeprecationWarning(DeprecationWarning):\n    \\\"\\\"\\\"\n    Warning raised when a feature is deprecated in FastAPI.\n    \\\"\\\"\\\"\n\n\nclass EndpointContext(TypedDict, total=False):\n",
 "old_string": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, Union\n\nfrom annotated_doc import Doc\nfrom pydantic import BaseModel, create_model\nfrom starlette.exceptions import HTTPException as StarletteHTTPException\nfrom starlette.exceptions import WebSocketException as StarletteWebSocketException\n\n\nclass EndpointContext(TypedDict, total=False):\n"
}
{"status": "ok", "filepath": "fastapi/exceptions.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/exceptions.py\n+++ b/fastapi/exceptions.py\n
full
{"status": "ok", "filepath": "fastapi/exceptions.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/exceptions.py\n+++ b/fastapi/exceptions.py\n@@ -5,6 +5,12 @@\n from pydantic import BaseModel, create_model\n from starlette.exceptions import HTTPException as StarletteHTTPException\n from starlette.exceptions import WebSocketException as StarletteWebSocketException\n+\n+\n+class FastAPIDeprecationWarning(DeprecationWarning):\n+    \\\"\\\"\\\"\n+    Warning raised when a feature is deprecated in FastAPI.\n+    \\\"\\\"\\\"\n \n \n class EndpointContext(TypedDict, total=False):\n", "is_truncated": false}
6read_file
{
 "filepath": "fastapi/dependencies/utils.py",
 "start_line": 320,
 "end_line": 340
}
{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "content": " ):\n assert param_details.field is None, (\n f\"Cannot specify multiple FastAPI annot
full
{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "content": "        ):\n            assert param_details.field is None, (\n                f\"Cannot specify multiple FastAPI annotations for {param_name!r}\"\n            )\n            continue\n        assert param_details.field is not None\n        if isinstance(param_details.field, may_v1.ModelField):\n            warnings.warn(\n                \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n                category=DeprecationWarning,\n                stacklevel=5,\n            )\n        if isinstance(\n            param_details.field.field_info, (params.Body, temp_pydantic_v1_params.Body)\n        ):\n            dependant.body_params.append(param_details.field)\n        else:\n            add_param_to_fields(field=param_details.field, dependant=dependant)\n    return dependant\n\n", "start_line": 320, "end_line": 340, "total_lines": 1069, "is_truncated": false}
7edit_file
{
 "filepath": "fastapi/dependencies/utils.py",
 "new_string": "        if isinstance(param_details.field, may_v1.ModelField):\n            warnings.warn(\n                \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n                category=FastAPIDeprecationWarning,\n                stacklevel=5,\n            )\n",
 "old_string": "        if isinstance(param_details.field, may_v1.ModelField):\n            warnings.warn(\n                \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n                category=DeprecationWarning,\n                stacklevel=5,\n            )\n"
}
{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/dependencies/utils.py\n+++ b/fastapi
full
{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/dependencies/utils.py\n+++ b/fastapi/dependencies/utils.py\n@@ -327,7 +327,7 @@\n             warnings.warn(\n                 \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                 f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=5,\n             )\n         if isinstance(\n", "is_truncated": false}
8run_command
{
 "command": "grep -rn \"category=DeprecationWarning\" fastapi | head -20"
}
{"status": "ok", "stdout": "fastapi/temp_pydantic_v1_params.py:66: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:96: category=DeprecationWarn
full
{"status": "ok", "stdout": "fastapi/temp_pydantic_v1_params.py:66:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:96:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:506:                category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:536:                category=DeprecationWarning,\nfastapi/routing.py:643:                    category=DeprecationWarning,\nfastapi/routing.py:683:                        category=DeprecationWarning,\nfastapi/params.py:78:                category=DeprecationWarning,\nfastapi/params.py:108:                category=DeprecationWarning,\nfastapi/params.py:533:                category=DeprecationWarning,\nfastapi/params.py:563:                category=DeprecationWarning,\n", "exit_code": 0}
9read_file
{
 "end_line": 110,
 "filepath": "fastapi/params.py",
 "start_line": 70
}
{"status": "ok", "filepath": "fastapi/params.py", "content": " deprecated: Union[deprecated, str, bool, None] = None,\n include_in_schema: bool = True,\n json_s
full
{"status": "ok", "filepath": "fastapi/params.py", "content": "        deprecated: Union[deprecated, str, bool, None] = None,\n        include_in_schema: bool = True,\n        json_schema_extra: Union[dict[str, Any], None] = None,\n        **extra: Any,\n    ):\n        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        self.example = example\n        self.include_in_schema = include_in_schema\n        self.openapi_examples = openapi_examples\n        kwargs = dict(\n            default=default,\n            default_factory=default_factory,\n            alias=alias,\n            title=title,\n            description=description,\n            gt=gt,\n            ge=ge,\n            lt=lt,\n            le=le,\n            min_length=min_length,\n            max_length=max_length,\n            discriminator=discriminator,\n            multiple_of=multiple_of,\n            allow_inf_nan=allow_inf_nan,\n            max_digits=max_digits,\n            decimal_places=decimal_places,\n            **extra,\n        )\n        if examples is not None:\n            kwargs[\"examples\"] = examples\n        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n", "start_line": 70, "end_line": 110, "total_lines": 769, "is_truncated": false}
10read_file
{
 "end_line": 570,
 "filepath": "fastapi/params.py",
 "start_line": 520
}
{"status": "ok", "filepath": "fastapi/params.py", "content": " ),\n ] = _Unset,\n openapi_examples: Optional[dict[str, Example]] = None,\n deprecated: Union[dep
full
{"status": "ok", "filepath": "fastapi/params.py", "content": "            ),\n        ] = _Unset,\n        openapi_examples: Optional[dict[str, Example]] = None,\n        deprecated: Union[deprecated, str, bool, None] = None,\n        include_in_schema: bool = True,\n        json_schema_extra: Union[dict[str, Any], None] = None,\n        **extra: Any,\n    ):\n        self.embed = embed\n        self.media_type = media_type\n        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        self.example = example\n        self.include_in_schema = include_in_schema\n        self.openapi_examples = openapi_examples\n        kwargs = dict(\n            default=default,\n            default_factory=default_factory,\n            alias=alias,\n            title=title,\n            description=description,\n            gt=gt,\n            ge=ge,\n            lt=lt,\n            le=le,\n            min_length=min_length,\n            max_length=max_length,\n            discriminator=discriminator,\n            multiple_of=multiple_of,\n            allow_inf_nan=allow_inf_nan,\n            max_digits=max_digits,\n            decimal_places=decimal_places,\n            **extra,\n        )\n        if examples is not None:\n            kwargs[\"examples\"] = examples\n        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        current_json_schema_extra = json_schema_extra or extra\n        kwargs[\"deprecated\"] = deprecated\n        if serialization_alias in (_Unset, None) and isinstance(alias, str):\n            serialization_alias = alias\n        if validation_alias in (_Unset, None):\n", "start_line": 520, "end_line": 57
11read_file
{
 "end_line": 100,
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "start_line": 50
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": " example: Annotated[\n Optional[Any],\n deprecated(\n \"Deprecated in OpenAPI 3.1
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": "        example: Annotated[\n            Optional[Any],\n            deprecated(\n                \"Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, \"\n                \"although still supported. Use examples instead.\"\n            ),\n        ] = _Unset,\n        openapi_examples: Optional[dict[str, Example]] = None,\n        deprecated: Union[deprecated, str, bool, None] = None,\n        include_in_schema: bool = True,\n        json_schema_extra: Union[dict[str, Any], None] = None,\n        **extra: Any,\n    ):\n        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        self.example = example\n        self.include_in_schema = include_in_schema\n        self.openapi_examples = openapi_examples\n        kwargs = dict(\n            default=default,\n            default_factory=default_factory,\n            alias=alias,\n            title=title,\n            description=description,\n            gt=gt,\n            ge=ge,\n            lt=lt,\n            le=le,\n            min_length=min_length,\n            max_length=max_length,\n            discriminator=discriminator,\n            multiple_of=multiple_of,\n            allow_inf_nan=allow_inf_nan,\n            max_digits=max_digits,\n            decimal_places=decimal_places,\n            **extra,\n        )\n        if examples is not None:\n            kwargs[\"examples\"] = examples\n        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        current_json_schema_extra = json_schema_extra or extra\n        kwargs[\"deprecated\"] = deprecated\n", "start_line":
12read_file
{
 "end_line": 600,
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "start_line": 500
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": " ):\n self.embed = embed\n self.media_type = media_type\n if example is not _Unse
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": "    ):\n        self.embed = embed\n        self.media_type = media_type\n        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        self.example = example\n        self.include_in_schema = include_in_schema\n        self.openapi_examples = openapi_examples\n        kwargs = dict(\n            default=default,\n            default_factory=default_factory,\n            alias=alias,\n            title=title,\n            description=description,\n            gt=gt,\n            ge=ge,\n            lt=lt,\n            le=le,\n            min_length=min_length,\n            max_length=max_length,\n            discriminator=discriminator,\n            multiple_of=multiple_of,\n            allow_inf_nan=allow_inf_nan,\n            max_digits=max_digits,\n            decimal_places=decimal_places,\n            **extra,\n        )\n        if examples is not None:\n            kwargs[\"examples\"] = examples\n        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        current_json_schema_extra = json_schema_extra or extra\n        kwargs[\"deprecated\"] = deprecated\n        kwargs[\"regex\"] = pattern or regex\n        kwargs.update(**current_json_schema_extra)\n\n        use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset}\n\n        super().__init__(**use_kwargs)\n\n    def __repr__(self) -> str:\n        return f\"{self.__class__.__name__}({self.default})\"\n\n\nclass Form(Body):\n    def __init__(\n        self,\n        default: Any = Undefined,\n        *,\n        default_factory: Union[Callable[[], Any], None] = _Un
13run_command
{
 "command": "grep -rn \"category=DeprecationWarning\" fastapi/routing.py"
}
{"status": "ok", "stdout": "643: category=DeprecationWarning,\n683: category=DeprecationWarning,\n", "exit_code": 0}
full
{"status": "ok", "stdout": "643:                    category=DeprecationWarning,\n683:                        category=DeprecationWarning,\n", "exit_code": 0}
14read_file
{
 "end_line": 650,
 "filepath": "fastapi/routing.py",
 "start_line": 630
}
{"status": "ok", "filepath": "fastapi/routing.py", "content": " # normalize enums e.g. http.HTTPStatus\n if isinstance(status_code, IntEnum):\n status_code = in
full
{"status": "ok", "filepath": "fastapi/routing.py", "content": "        # normalize enums e.g. http.HTTPStatus\n        if isinstance(status_code, IntEnum):\n            status_code = int(status_code)\n        self.status_code = status_code\n        if self.response_model:\n            assert is_body_allowed_for_status_code(status_code), (\n                f\"Status code {status_code} must not have a response body\"\n            )\n            response_name = \"Response_\" + self.unique_id\n            if annotation_is_pydantic_v1(self.response_model):\n                warnings.warn(\n                    \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                    f\" Please update the response model {self.response_model!r}.\",\n                    category=DeprecationWarning,\n                    stacklevel=4,\n                )\n            self.response_field = create_model_field(\n                name=response_name,\n                type_=self.response_model,\n                mode=\"serialization\",\n            )\n", "start_line": 630, "end_line": 650, "total_lines": 4583, "is_truncated": false}
15read_file
{
 "end_line": 690,
 "filepath": "fastapi/routing.py",
 "start_line": 670
}
{"status": "ok", "filepath": "fastapi/routing.py", "content": " response_fields = {}\n for additional_status_code, response in self.responses.items():\n assert
full
{"status": "ok", "filepath": "fastapi/routing.py", "content": "        response_fields = {}\n        for additional_status_code, response in self.responses.items():\n            assert isinstance(response, dict), \"An additional response must be a dict\"\n            model = response.get(\"model\")\n            if model:\n                assert is_body_allowed_for_status_code(additional_status_code), (\n                    f\"Status code {additional_status_code} must not have a response body\"\n                )\n                response_name = f\"Response_{additional_status_code}_{self.unique_id}\"\n                if annotation_is_pydantic_v1(model):\n                    warnings.warn(\n                        \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                        f\" In responses={{}}, please update {model}.\",\n                        category=DeprecationWarning,\n                        stacklevel=4,\n                    )\n                response_field = create_model_field(\n                    name=response_name, type_=model, mode=\"serialization\"\n                )\n                response_fields[additional_status_code] = response_field\n        if response_fields:\n", "start_line": 670, "end_line": 690, "total_lines": 4583, "is_truncated": false}
16edit_file
{
 "filepath": "fastapi/dependencies/utils.py",
 "new_string": "from fastapi import params\nfrom fastapi.exceptions import FastAPIDeprecationWarning\n",
 "old_string": "from fastapi import params\n"
}
{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/dependencies/utils.py\n+++ b/fastapi
full
{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/dependencies/utils.py\n+++ b/fastapi/dependencies/utils.py\n@@ -18,6 +18,7 @@\n \n import anyio\n from fastapi import params\n+from fastapi.exceptions import FastAPIDeprecationWarning\n from fastapi._compat import (\n     ModelField,\n     RequiredParam,\n", "is_truncated": false}
17edit_file
{
 "filepath": "fastapi/routing.py",
 "new_string": "                if annotation_is_pydantic_v1(self.response_model):\n                    warnings.warn(\n                        \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                        f\" Please update the response model {self.response_model!r}.\",\n                        category=FastAPIDeprecationWarning,\n                        stacklevel=4,\n                    )\n",
 "old_string": "                if annotation_is_pydantic_v1(self.response_model):\n                    warnings.warn(\n                        \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                        f\" Please update the response model {self.response_model!r}.\",\n                        category=DeprecationWarning,\n                        stacklevel=4,\n                    )\n"
}
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "flexible", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -64
full
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "flexible", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -640,7 +640,7 @@\n                 warnings.warn(\n                     \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                     f\" Please update the response model {self.response_model!r}.\",\n-                    category=DeprecationWarning,\n+                    category=FastAPIDeprecationWarning,\n                     stacklevel=4,\n                 )\n             self.response_field = create_model_field(\n", "is_truncated": false}
18edit_file
{
 "filepath": "fastapi/routing.py",
 "new_string": "                if annotation_is_pydantic_v1(model):\n                    warnings.warn(\n                        \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                        f\" In responses={{}}, please update {model}.\",\n                        category=FastAPIDeprecationWarning,\n                        stacklevel=4,\n                    )\n",
 "old_string": "                if annotation_is_pydantic_v1(model):\n                    warnings.warn(\n                        \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                        f\" In responses={{}}, please update {model}.\",\n                        category=DeprecationWarning,\n                        stacklevel=4,\n                    )\n"
}
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -680,7
full
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -680,7 +680,7 @@\n                     warnings.warn(\n                         \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n                         f\" In responses={{}}, please update {model}.\",\n-                        category=DeprecationWarning,\n+                        category=FastAPIDeprecationWarning,\n                         stacklevel=4,\n                     )\n                 response_field = create_model_field(\n", "is_truncated": false}
19edit_file
{
 "filepath": "fastapi/routing.py",
 "new_string": "from fastapi import params\nfrom fastapi.exceptions import FastAPIDeprecationWarning\n",
 "old_string": "from fastapi import params\n"
}
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "regex", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -22,7
full
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "regex", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -22,7 +22,9 @@\n )\n \n from annotated_doc import Doc\n-from fastapi import params, temp_pydantic_v1_params\n+from fastapi import params\n+from fastapi.exceptions import FastAPIDeprecationWarning\n+, temp_pydantic_v1_params\n from fastapi._compat import (\n     ModelField,\n     Undefined,\n", "is_truncated": false}
20edit_file
{
 "filepath": "fastapi/routing.py",
 "new_string": "from fastapi import params, temp_pydantic_v1_params\nfrom fastapi.exceptions import FastAPIDeprecationWarning\n",
 "old_string": "from fastapi import params\nfrom fastapi.exceptions import FastAPIDeprecationWarning\n, temp_pydantic_v1_params\n"
}
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -22,9
full
{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -22,9 +22,8 @@\n )\n \n from annotated_doc import Doc\n-from fastapi import params\n+from fastapi import params, temp_pydantic_v1_params\n from fastapi.exceptions import FastAPIDeprecationWarning\n-, temp_pydantic_v1_params\n from fastapi._compat import (\n     ModelField,\n     Undefined,\n", "is_truncated": false}
21run_command
{
 "command": "grep -rn \"category=DeprecationWarning\" fastapi/temp_pydantic_v1_params.py"
}
{"status": "ok", "stdout": "66: category=DeprecationWarning,\n96: category=DeprecationWarning,\n506: category=DeprecationWarning,\n536: category=DeprecationWarn
full
{"status": "ok", "stdout": "66:                category=DeprecationWarning,\n96:                category=DeprecationWarning,\n506:                category=DeprecationWarning,\n536:                category=DeprecationWarning,\n", "exit_code": 0}
22read_file
{
 "end_line": 110,
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "start_line": 60
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": " json_schema_extra: Union[dict[str, Any], None] = None,\n **extra: Any,\n ):\n if
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": "        json_schema_extra: Union[dict[str, Any], None] = None,\n        **extra: Any,\n    ):\n        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        self.example = example\n        self.include_in_schema = include_in_schema\n        self.openapi_examples = openapi_examples\n        kwargs = dict(\n            default=default,\n            default_factory=default_factory,\n            alias=alias,\n            title=title,\n            description=description,\n            gt=gt,\n            ge=ge,\n            lt=lt,\n            le=le,\n            min_length=min_length,\n            max_length=max_length,\n            discriminator=discriminator,\n            multiple_of=multiple_of,\n            allow_inf_nan=allow_inf_nan,\n            max_digits=max_digits,\n            decimal_places=decimal_places,\n            **extra,\n        )\n        if examples is not None:\n            kwargs[\"examples\"] = examples\n        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n        current_json_schema_extra = json_schema_extra or extra\n        kwargs[\"deprecated\"] = deprecated\n        kwargs[\"regex\"] = pattern or regex\n        kwargs.update(**current_json_schema_extra)\n        use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset}\n\n        super().__init__(**use_kwargs)\n\n    def __repr__(self) -> str:\n        return f\"{self.__class__.__name__}({self.default})\"\n\n\n", "start_line": 60, "end_line": 110, "total_lines": 717, "is_truncated": false}
23edit_file
{
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "new_string": "from fastapi.exceptions import FastAPIDeprecationWarning\n",
 "old_string": "from typing import Any, Callable, Union\n"
}
{"status": "error", "error_type": "FileEditError", "error_message": "old_string not found in file (tried exact, flexible and regex matching)"}
full
{"status": "error", "error_type": "FileEditError", "error_message": "old_string not found in file (tried exact, flexible and regex matching)"}
24read_file
{
 "end_line": 20,
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "start_line": 1
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": "import warnings\nfrom typing import Annotated, Any, Callable, Optional, Union\n\n
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "content": "import warnings\nfrom typing import Annotated, Any, Callable, Optional, Union\n\nfrom fastapi.openapi.models import Example\nfrom fastapi.params import ParamTypes\nfrom typing_extensions import deprecated\n\nfrom ._compat.may_v1 import FieldInfo, Undefined\n\n_Unset: Any = Undefined\n\n\nclass Param(FieldInfo):\n    in_: ParamTypes\n\n    def __init__(\n        self,\n        default: Any = Undefined,\n        *,\n        default_factory: Union[Callable[[], Any], None] = _Unset,\n", "start_line": 1, "end_line": 20, "total_lines": 717, "is_truncated": false}
25edit_file
{
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "new_string": "import warnings\nfrom typing import Annotated, Any, Callable, Optional, Union\n\nfrom fastapi.exceptions import FastAPIDeprecationWarning\nfrom fastapi.openapi.models import Example\n",
 "old_string": "import warnings\nfrom typing import Annotated, Any, Callable, Optional, Union\n\nfrom fastapi.openapi.models import Example\n"
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++ b/fastapi/temp_pydantic_v1_params.py\n@@ -1,6 +1,7 @@\n import warnings\n from typing import Annotated, Any, Callable, Optional, Union\n \n+from fastapi.exceptions import FastAPIDeprecationWarning\n from fastapi.openapi.models import Example\n from fastapi.params import ParamTypes\n from typing_extensions import deprecated\n", "is_truncated": false}
26edit_file
{
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "new_string": "        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=FastAPIDeprecationWarning,\n                stacklevel=4,\n            )\n",
 "old_string": "        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n",
 "allow_multiple": true
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++ b/fastapi/temp_pydantic_v1_params.py\n@@ -64,7 +64,7 @@\n         if example is not _Unset:\n             warnings.warn(\n                 \"`example` has been deprecated, please use `examples` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         self.example = example\n@@ -504,7 +504,7 @@\n         if example is not _Unset:\n             warnings.warn(\n                 \"`example` has been deprecated, please use `examples` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         self.example = example\n", "is_truncated": false}
27edit_file
{
 "allow_multiple": true,
 "filepath": "fastapi/temp_pydantic_v1_params.py",
 "new_string": "        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=FastAPIDeprecationWarning,\n                stacklevel=4,\n            )\n",
 "old_string": "        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n"
}
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++
full
{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++ b/fastapi/temp_pydantic_v1_params.py\n@@ -94,7 +94,7 @@\n         if regex is not None:\n             warnings.warn(\n                 \"`regex` has been deprecated, please use `pattern` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         current_json_schema_extra = json_schema_extra or extra\n@@ -534,7 +534,7 @@\n         if regex is not None:\n             warnings.warn(\n                 \"`regex` has been deprecated, please use `pattern` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         current_json_schema_extra = json_schema_extra or extra\n", "is_truncated": false}
28run_command
{
 "command": "grep -rn \"category=DeprecationWarning\" fastapi | head -20"
}
{"status": "ok", "stdout": "fastapi/params.py:78: category=DeprecationWarning,\nfastapi/params.py:108: category=DeprecationWarning,\nfastapi/params.py:533: cate
full
{"status": "ok", "stdout": "fastapi/params.py:78:                category=DeprecationWarning,\nfastapi/params.py:108:                category=DeprecationWarning,\nfastapi/params.py:533:                category=DeprecationWarning,\nfastapi/params.py:563:                category=DeprecationWarning,\n", "exit_code": 0}
29edit_file
{
 "filepath": "fastapi/params.py",
 "new_string": "from fastapi.exceptions import FastAPIDeprecationWarning\n",
 "old_string": "from typing import Any, Callable, Union\n"
}
{"status": "error", "error_type": "FileEditError", "error_message": "old_string not found in file (tried exact, flexible and regex matching)"}
full
{"status": "error", "error_type": "FileEditError", "error_message": "old_string not found in file (tried exact, flexible and regex matching)"}
30read_file
{
 "end_line": 20,
 "filepath": "fastapi/params.py",
 "start_line": 1
}
{"status": "ok", "filepath": "fastapi/params.py", "content": "import warnings\nfrom collections.abc import Sequence\nfrom dataclasses import dataclass\nfrom enu
full
{"status": "ok", "filepath": "fastapi/params.py", "content": "import warnings\nfrom collections.abc import Sequence\nfrom dataclasses import dataclass\nfrom enum import Enum\nfrom typing import Annotated, Any, Callable, Optional, Union\n\nfrom fastapi.openapi.models import Example\nfrom pydantic.fields import FieldInfo\nfrom typing_extensions import Literal, deprecated\n\nfrom ._compat import (\n    Undefined,\n)\n\n_Unset: Any = Undefined\n\n\nclass ParamTypes(Enum):\n    query = \"query\"\n    header = \"header\"\n", "start_line": 1, "end_line": 20, "total_lines": 769, "is_truncated": false}
31edit_file
{
 "filepath": "fastapi/params.py",
 "new_string": "import warnings\nfrom collections.abc import Sequence\nfrom dataclasses import dataclass\nfrom enum import Enum\nfrom typing import Annotated, Any, Callable, Optional, Union\n\nfrom fastapi.exceptions import FastAPIDeprecationWarning\nfrom fastapi.openapi.models import Example\n",
 "old_string": "import warnings\nfrom collections.abc import Sequence\nfrom dataclasses import dataclass\nfrom enum import Enum\nfrom typing import Annotated, Any, Callable, Optional, Union\n\nfrom fastapi.openapi.models import Example\n"
}
{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -4,6 +4,7
full
{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -4,6 +4,7 @@\n from enum import Enum\n from typing import Annotated, Any, Callable, Optional, Union\n \n+from fastapi.exceptions import FastAPIDeprecationWarning\n from fastapi.openapi.models import Example\n from pydantic.fields import FieldInfo\n from typing_extensions import Literal, deprecated\n", "is_truncated": false}
32edit_file
{
 "allow_multiple": true,
 "filepath": "fastapi/params.py",
 "new_string": "        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=FastAPIDeprecationWarning,\n                stacklevel=4,\n            )\n",
 "old_string": "        if example is not _Unset:\n            warnings.warn(\n                \"`example` has been deprecated, please use `examples` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n"
}
{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -76,7 +76
full
{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -76,7 +76,7 @@\n         if example is not _Unset:\n             warnings.warn(\n                 \"`example` has been deprecated, please use `examples` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         self.example = example\n@@ -531,7 +531,7 @@\n         if example is not _Unset:\n             warnings.warn(\n                 \"`example` has been deprecated, please use `examples` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         self.example = example\n", "is_truncated": false}
33edit_file
{
 "allow_multiple": true,
 "filepath": "fastapi/params.py",
 "new_string": "        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=FastAPIDeprecationWarning,\n                stacklevel=4,\n            )\n",
 "old_string": "        if regex is not None:\n            warnings.warn(\n                \"`regex` has been deprecated, please use `pattern` instead\",\n                category=DeprecationWarning,\n                stacklevel=4,\n            )\n"
}
{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -106,7 +1
full
{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -106,7 +106,7 @@\n         if regex is not None:\n             warnings.warn(\n                 \"`regex` has been deprecated, please use `pattern` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         current_json_schema_extra = json_schema_extra or extra\n@@ -561,7 +561,7 @@\n         if regex is not None:\n             warnings.warn(\n                 \"`regex` has been deprecated, please use `pattern` instead\",\n-                category=DeprecationWarning,\n+                category=FastAPIDeprecationWarning,\n                 stacklevel=4,\n             )\n         current_json_schema_extra = json_schema_extra or extra\n", "is_truncated": false}
34run_command
{
 "command": "grep -rn \"category=DeprecationWarning\" fastapi"
}
{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "", "exit_code": 1}}
full
{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "", "exit_code": 1}}
35submit_patch
[]
{"status": "ok", "patch_size": 6749, "files_changed": 5}
full
{"status": "ok", "patch_size": 6749, "files_changed": 5}

Patch

diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py
index 39d0bd89..dc951a70 100644
--- a/fastapi/dependencies/utils.py
+++ b/fastapi/dependencies/utils.py
@@ -18,6 +18,7 @@ from typing import (
 
 import anyio
 from fastapi import params
+from fastapi.exceptions import FastAPIDeprecationWarning
 from fastapi._compat import (
     ModelField,
     RequiredParam,
@@ -327,7 +328,7 @@ def get_dependant(
             warnings.warn(
                 "pydantic.v1 is deprecated and will soon stop being supported by FastAPI."
                 f" Please update the param {param_name}: {param_details.type_annotation!r}.",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=5,
             )
         if isinstance(
diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py
index 8e0c5590..26918f63 100644
--- a/fastapi/exceptions.py
+++ b/fastapi/exceptions.py
@@ -7,6 +7,12 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 from starlette.exceptions import WebSocketException as StarletteWebSocketException
 
 
+class FastAPIDeprecationWarning(DeprecationWarning):
+    \"\"\"
+    Warning raised when a feature is deprecated in FastAPI.
+    \"\"\"
+
+
 class EndpointContext(TypedDict, total=False):
     function: str
     path: str
diff --git a/fastapi/params.py b/fastapi/params.py
index c776c4a5..cc2934f4 100644
--- a/fastapi/params.py
+++ b/fastapi/params.py
@@ -4,6 +4,7 @@ from dataclasses import dataclass
 from enum import Enum
 from typing import Annotated, Any, Callable, Optional, Union
 
+from fastapi.exceptions import FastAPIDeprecationWarning
 from fastapi.openapi.models import Example
 from pydantic.fields import FieldInfo
 from typing_extensions import Literal, deprecated
@@ -75,7 +76,7 @@ class Param(FieldInfo):  # type: ignore[misc]
         if example is not _Unset:
             warnings.warn(
                 "`example` has been deprecated, please use `examples` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         self.example = example
@@ -105,7 +106,7 @@ class Param(FieldInfo):  # type: ignore[misc]
         if regex is not None:
             warnings.warn(
                 "`regex` has been deprecated, please use `pattern` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         current_json_schema_extra = json_schema_extra or extra
@@ -530,7 +531,7 @@ class Body(FieldInfo):  # type: ignore[misc]
         if example is not _Unset:
             warnings.warn(
                 "`example` has been deprecated, please use `examples` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         self.example = example
@@ -560,7 +561,7 @@ class Body(FieldInfo):  # type: ignore[misc]
         if regex is not None:
             warnings.warn(
                 "`regex` has been deprecated, please use `pattern` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         current_json_schema_extra = json_schema_extra or extra
diff --git a/fastapi/routing.py b/fastapi/routing.py
index 2770e325..231c711b 100644
--- a/fastapi/routing.py
+++ b/fastapi/routing.py
@@ -23,6 +23,7 @@ from typing import (
 
 from annotated_doc import Doc
 from fastapi import params, temp_pydantic_v1_params
+from fastapi.exceptions import FastAPIDeprecationWarning
 from fastapi._compat import (
     ModelField,
     Undefined,
@@ -640,7 +641,7 @@ class APIRoute(routing.Route):
                 warnings.warn(
                     "pydantic.v1 is deprecated and will soon stop being supported by FastAPI."
                     f" Please update the response model {self.response_model!r}.",
-                    category=DeprecationWarning,
+                    category=FastAPIDeprecationWarning,
                     stacklevel=4,
                 )
             self.response_field = create_model_field(
@@ -680,7 +681,7 @@ class APIRoute(routing.Route):
                     warnings.warn(
                         "pydantic.v1 is deprecated and will soon stop being supported by FastAPI."
                         f" In responses={{}}, please update {model}.",
-                        category=DeprecationWarning,
+                        category=FastAPIDeprecationWarning,
                         stacklevel=4,
                     )
                 response_field = create_model_field(
diff --git a/fastapi/temp_pydantic_v1_params.py b/fastapi/temp_pydantic_v1_params.py
index 1bda0ea9..62230e42 100644
--- a/fastapi/temp_pydantic_v1_params.py
+++ b/fastapi/temp_pydantic_v1_params.py
@@ -1,6 +1,7 @@
 import warnings
 from typing import Annotated, Any, Callable, Optional, Union
 
+from fastapi.exceptions import FastAPIDeprecationWarning
 from fastapi.openapi.models import Example
 from fastapi.params import ParamTypes
 from typing_extensions import deprecated
@@ -63,7 +64,7 @@ class Param(FieldInfo):
         if example is not _Unset:
             warnings.warn(
                 "`example` has been deprecated, please use `examples` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         self.example = example
@@ -93,7 +94,7 @@ class Param(FieldInfo):
         if regex is not None:
             warnings.warn(
                 "`regex` has been deprecated, please use `pattern` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         current_json_schema_extra = json_schema_extra or extra
@@ -503,7 +504,7 @@ class Body(FieldInfo):
         if example is not _Unset:
             warnings.warn(
                 "`example` has been deprecated, please use `examples` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         self.example = example
@@ -533,7 +534,7 @@ class Body(FieldInfo):
         if regex is not None:
             warnings.warn(
                 "`regex` has been deprecated, please use `pattern` instead",
-                category=DeprecationWarning,
+                category=FastAPIDeprecationWarning,
                 stacklevel=4,
             )
         current_json_schema_extra = json_schema_extra or extra

Test output

show
==================================== ERRORS ====================================
________ ERROR collecting tests/benchmarks/test_general_performance.py _________
/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/_pytest/python.py:508: in importtestmodule
    mod = import_path(
/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/_pytest/pathlib.py:596: in import_path
    importlib.import_module(module_name)
/root/.local/share/uv/python/cpython-3.13.14-linux-x86_64-gnu/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<frozen importlib._bootstrap>:1395: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:188: in exec_module
    exec(co, module.__dict__)
tests/benchmarks/test_general_performance.py:8: in <module>
    from fastapi import Depends, FastAPI
fastapi/__init__.py:7: in <module>
    from .applications import FastAPI as FastAPI
fastapi/applications.py:13: in <module>
    from fastapi import routing
fastapi/routing.py:25: in <module>
    from fastapi import params, temp_pydantic_v1_params
fastapi/params.py:7: in <module>
    from fastapi.exceptions import FastAPIDeprecationWarning
E     File "/tmp/swe_work/eval4_submission_v1b/fastapi_14605/b/workspace/fastapi/exceptions.py", line 11
E       \"\"\"
E        ^
E   SyntaxError: unexpected character after line continuation character
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 error in 0.42s