failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(timeout) · 20 tool calls · 0 s · fastapi/fastapi
➖ Drop support for `pydantic.v1` ➖ Drop support for `pydantic.v1` When trying to use a `pydantic.v1` model with FastAPI, an error is raised.
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "cd /workspace && git log --oneline -5 && git status && ls fastapi"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cdfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cd: /tmp/swe_work/or20_qwen27b_v2/fastapi_14609/a/workspace: No such file or directory\n", "exit_code": 1}} |
| 2 | run_command | {
"command": "cd /workspace && grep -rn \"pydantic.v1\\|pydantic_v1\\|v1\" fastapi --include=*.py | head -50"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cdfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cd: /tmp/swe_work/or20_qwen27b_v2/fastapi_14609/a/workspace: No such file or directory\n", "exit_code": 1}} |
| 3 | run_command | {
"command": "pwd; ls; ls /workspace 2>/dev/null | head"
} | {"status": "ok", "stdout": "/private/workspace\nCITATION.cff\nCONTRIBUTING.md\ndocs\ndocs_src\nfastapi\nLICENSE\npdm_build.py\npyproject.toml\npytest.ini\nREADMfull{"status": "ok", "stdout": "/private/workspace\nCITATION.cff\nCONTRIBUTING.md\ndocs\ndocs_src\nfastapi\nLICENSE\npdm_build.py\npyproject.toml\npytest.ini\nREADME.md\nrequirements-docs-tests.txt\nrequirements-docs.txt\nrequirements-github-actions.txt\nrequirements-tests.txt\nrequirements-translations.txt\nrequirements.txt\nscripts\nSECURITY.md\ntests\n", "exit_code": 0} |
| 4 | run_command | {
"command": "cd /private/workspace && git log --oneline -5 && git status --short | head && ls fastapi"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cdfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cd: /private/workspace: No such file or directory\n", "exit_code": 1}} |
| 5 | run_command | {
"command": "cd /private/workspace && grep -rn \"pydantic.v1\\|pydantic_v1\" fastapi --include=*.py | head -60"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cdfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "/bin/bash: line 0: cd: /private/workspace: No such file or directory\n", "exit_code": 1}} |
| 6 | run_command | {
"command": "echo $PWD; ls -la / | head -30; find / -maxdepth 3 -name \"fastapi\" -type d 2>/dev/null | head"
} | {"status": "ok", "stdout": "/private/workspace\ntotal 10\ndrwxr-xr-x 22 root wheel 704 Aug 1 09:31 .\ndrwxr-xr-x 22 root wheel 704 Aug 1 09:31 ..\n---------- 1 full{"status": "ok", "stdout": "/private/workspace\ntotal 10\ndrwxr-xr-x 22 root wheel 704 Aug 1 09:31 .\ndrwxr-xr-x 22 root wheel 704 Aug 1 09:31 ..\n---------- 1 root admin 0 Aug 1 09:31 .file\ndrwxr-xr-x 2 root wheel 64 Aug 1 09:31 .nofollow\ndrwxr-xr-x 2 root wheel 64 Aug 1 09:31 .resolve\ndrwxr-xr-x 2 root wheel 64 Aug 1 09:31 .vol\nlrwxr-xr-x 1 root admin 36 Aug 1 09:31 .VolumeIcon.icns -> System/Volumes/Data/.VolumeIcon.icns\ndrwxrwxr-x 13 root admin 416 Sep 23 08:28 Applications\ndrwxr-xr-x@ 39 root wheel 1248 Aug 1 09:31 bin\ndrwxr-xr-x 2 root wheel 64 Sep 9 2021 cores\ndr-xr-xr-x 4 root wheel 4912 Sep 9 20:29 dev\nlrwxr-xr-x@ 1 root wheel 11 Aug 1 09:31 etc -> private/etc\nlrwxr-xr-x 1 root wheel 25 Sep 9 20:31 home -> /System/Volumes/Data/home\ndrwxr-xr-x 68 root wheel 2176 Sep 9 20:30 Library\ndrwxr-xr-x 3 root wheel 96 Feb 4 2025 opt\ndrwxr-xr-x 6 root wheel 192 Sep 9 20:31 private\ndrwxr-xr-x@ 76 root wheel 2432 Aug 1 09:31 sbin\ndrwxr-xr-x@ 10 root wheel 320 Aug 1 09:31 System\nlrwxr-xr-x@ 1 root wheel 11 Aug 1 09:31 tmp -> private/tmp\ndrwxr-xr-x 6 root admin 192 Sep 9 20:30 Users\ndrwxr-xr-x@ 11 root wheel 352 Aug 1 09:31 usr\nlrwxr-xr-x@ 1 root wheel 11 Aug 1 09:31 var -> private/var\ndrwxr-xr-x 3 root wheel 96 Sep 23 08:24 Volumes\n", "exit_code": 0} |
| 7 | run_command | {
"command": "git log --oneline -5; git status --short | head; ls fastapi"
} | {"status": "ok", "stdout": "c3c8d3f7 baseline\nb3af7c3f \ud83d\udcdd Update release notes\nbadd70f1 \u2705 Run performance tests only on Pydantic v2 (#14608)\n3full{"status": "ok", "stdout": "c3c8d3f7 baseline\nb3af7c3f \ud83d\udcdd Update release notes\nbadd70f1 \u2705 Run performance tests only on Pydantic v2 (#14608)\n3654e2b9 \ud83d\udd16 Release version 0.127.1\n2682e3d2 \ud83d\udcdd Update release notes\n__init__.py\n__main__.py\n_compat\napplications.py\nbackground.py\ncli.py\nconcurrency.py\ndatastructures.py\ndependencies\nencoders.py\nexception_handlers.py\nexceptions.py\nlogger.py\nmiddleware\nopenapi\nparam_functions.py\nparams.py\npy.typed\nrequests.py\nresponses.py\nrouting.py\nsecurity\nstaticfiles.py\ntemp_pydantic_v1_params.py\ntemplating.py\ntestclient.py\ntypes.py\nutils.py\nwebsockets.py\n", "exit_code": 0} |
| 8 | run_command | {
"command": "ls fastapi/_compat; grep -rn \"v1\" fastapi --include=*.py | grep -iv \"v1_\" | head -60"
} | {"status": "ok", "stdout": "__init__.py\nmain.py\nmay_v1.py\nmodel_field.py\nshared.py\nv1.py\nv2.py\nfastapi/params.py:37: # TODO: update when deprecating Pydafull{"status": "ok", "stdout": "__init__.py\nmain.py\nmay_v1.py\nmodel_field.py\nshared.py\nv1.py\nv2.py\nfastapi/params.py:37: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:150: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:236: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:320: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:406: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:490: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:603: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/params.py:687: # TODO: update when deprecating Pydantic v1, import these types\nfastapi/applications.py:223: app = FastAPI(openapi_url=\"/api/v1/openapi.json\")\nfastapi/applications.py:662: app = FastAPI(root_path=\"/api/v1\")\nfastapi/dependencies/utils.py:42: may_v1,\nfastapi/dependencies/utils.py:47:from fastapi._compat.shared import annotation_is_pydantic_v1\nfastapi/dependencies/utils.py:326: if isinstance(param_details.field, may_v1.ModelField):\nfastapi/dependencies/utils.py:328: \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\nfastapi/dependencies/utils.py:394: if isinstance(arg, (FieldInfo, may_v1.FieldInfo, params.Depends))\nfastapi/dependencies/utils.py:412: FieldInfo, may_v1.FieldInfo, params.Depends, None\nfastapi/dependencies/utils.py:417: if isinstance(fastapi_annotation, (FieldInfo, may_v1.FieldInfo)):\nfastapi/dependencies/utils.py:425: may_v1.Undefined,\nfastapi/dependencies/utils.py:426: } or field_info.default in {RequiredParam, may_v1.RequiredParam}, (\nfastapi/dependencies/utils.py:450: elif isinstance(value, (FieldInfo, may_v1.FieldI |
| 9 | run_command | {
"command": "ls docs/en/release-notes.md 2>/dev/null; find . -name \"release-notes.md\" -not -path \"*/node_modules/*\" | head; head -60 docs/en/release-notes.md 2>/dev/null"
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "./docs/en/docs/release-notes.md\n",full{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "./docs/en/docs/release-notes.md\n", "stderr": "", "exit_code": 1}} |
| 10 | read_file | {
"filepath": "fastapi/_compat/__init__.py"
} | {"status": "ok", "filepath": "fastapi/_compat/__init__.py", "content": "from .main import BaseConfig as BaseConfig\nfrom .main import PydanticSchemaGenerationErfull{"status": "ok", "filepath": "fastapi/_compat/__init__.py", "content": "from .main import BaseConfig as BaseConfig\nfrom .main import PydanticSchemaGenerationError as PydanticSchemaGenerationError\nfrom .main import RequiredParam as RequiredParam\nfrom .main import Undefined as Undefined\nfrom .main import UndefinedType as UndefinedType\nfrom .main import Url as Url\nfrom .main import Validator as Validator\nfrom .main import _get_model_config as _get_model_config\nfrom .main import _is_error_wrapper as _is_error_wrapper\nfrom .main import _is_model_class as _is_model_class\nfrom .main import _is_model_field as _is_model_field\nfrom .main import _is_undefined as _is_undefined\nfrom .main import _model_dump as _model_dump\nfrom .main import copy_field_info as copy_field_info\nfrom .main import create_body_model as create_body_model\nfrom .main import evaluate_forwardref as evaluate_forwardref\nfrom .main import get_annotation_from_field_info as get_annotation_from_field_info\nfrom .main import get_cached_model_fields as get_cached_model_fields\nfrom .main import get_compat_model_name_map as get_compat_model_name_map\nfrom .main import get_definitions as get_definitions\nfrom .main import get_missing_field_error as get_missing_field_error\nfrom .main import get_schema_from_model_field as get_schema_from_model_field\nfrom .main import is_bytes_field as is_bytes_field\nfrom .main import is_bytes_sequence_field as is_bytes_sequence_field\nfrom .main import is_scalar_field as is_scalar_field\nfrom .main import is_scalar_sequence_field as is_scalar_sequence_field\nfrom .main import is_sequence_field as is_sequence_field\nfrom .main import serialize_sequence_value as serialize_sequence_value\nfrom .main import (\n with_info_plain_validator_function as with_info_plain_validator_function,\n)\nfrom .may_v1 import CoreSchema as CoreSchema\nfrom .may_v1 import GetJsonSchemaHandler as GetJsonSchemaHandler\nfrom .may_v1 import JsonSchemaValue as JsonSchemaValue\nfrom .may_v1 im |
| 11 | run_command | {
"command": "head -80 docs/en/docs/release-notes.md"
} | {"status": "ok", "stdout": "---\nhide:\n - navigation\n---\n\n# Release Notes\n\n## Latest Changes\n\n### Internal\n\n* \u2705 Run performance tests only on Pydfull{"status": "ok", "stdout": "---\nhide:\n - navigation\n---\n\n# Release Notes\n\n## Latest Changes\n\n### Internal\n\n* \u2705 Run performance tests only on Pydantic v2. PR [#14608](https://github.com/fastapi/fastapi/pull/14608) by [@tiangolo](https://github.com/tiangolo).\n\n## 0.127.1\n\n### Refactors\n\n* \ud83d\udd0a Add a custom `FastAPIDeprecationWarning`. PR [#14605](https://github.com/fastapi/fastapi/pull/14605) by [@tiangolo](https://github.com/tiangolo).\n\n### Docs\n\n* \ud83d\udcdd Add documentary to website. PR [#14600](https://github.com/fastapi/fastapi/pull/14600) by [@tiangolo](https://github.com/tiangolo).\n\n### Translations\n\n* \ud83c\udf10 Update translations for de (update-outdated). PR [#14602](https://github.com/fastapi/fastapi/pull/14602) by [@nilslindemann](https://github.com/nilslindemann).\n* \ud83c\udf10 Update translations for de (update-outdated). PR [#14581](https://github.com/fastapi/fastapi/pull/14581) by [@nilslindemann](https://github.com/nilslindemann).\n\n### Internal\n\n* \ud83d\udd27 Update pre-commit to use local Ruff instead of hook. PR [#14604](https://github.com/fastapi/fastapi/pull/14604) by [@tiangolo](https://github.com/tiangolo).\n* \u2705 Add missing tests for code examples. PR [#14569](https://github.com/fastapi/fastapi/pull/14569) by [@YuriiMotov](https://github.com/YuriiMotov).\n* \ud83d\udc77 Remove `lint` job from `test` CI workflow. PR [#14593](https://github.com/fastapi/fastapi/pull/14593) by [@YuriiMotov](https://github.com/YuriiMotov).\n* \ud83d\udc77 Update secrets check. PR [#14592](https://github.com/fastapi/fastapi/pull/14592) by [@tiangolo](https://github.com/tiangolo).\n* \ud83d\udc77 Run CodSpeed tests in parallel to other tests to speed up CI. PR [#14586](https://github.com/fastapi/fastapi/pull/14586) by [@tiangolo](https://github.com/tiangolo).\n* \ud83d\udd28 Update scripts and pre-commit to autofix files. PR [#14585](https://github.com/fastapi/fastapi/pull/14585) by [@tiangolo](https://github.com/ |
| 12 | run_command | {
"command": "sed -n '300,340p' fastapi/dependencies/utils.py; echo ----; sed -n '620,700p' fastapi/routing.py"
} | {"status": "ok", "stdout": " )\n sub_own_oauth_scopes: list[str] = []\n if isinstance(param_details.depends, params.Security):\n if param_details.depends.scopesfull{"status": "ok", "stdout": " )\n sub_own_oauth_scopes: list[str] = []\n if isinstance(param_details.depends, params.Security):\n if param_details.depends.scopes:\n sub_own_oauth_scopes = list(param_details.depends.scopes)\n sub_dependant = get_dependant(\n path=path,\n call=param_details.depends.dependency,\n name=param_name,\n own_oauth_scopes=sub_own_oauth_scopes,\n parent_oauth_scopes=current_scopes,\n use_cache=param_details.depends.use_cache,\n scope=param_details.depends.scope,\n )\n dependant.dependencies.append(sub_dependant)\n continue\n if add_non_field_param_to_dependency(\n param_name=param_name,\n type_annotation=param_details.type_annotation,\n dependant=dependant,\n ):\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=FastAPIDeprecationWarning,\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----\n self.path_regex, self.path_format, self.param_convertors = compile_path(path)\n if methods is None:\n |
| 13 | run_command | {
"command": "grep -rn \"may_v1\\|temp_pydantic_v1_params\\|annotation_is_pydantic_v1\\|PYDANTIC_V2\\|PYDANTIC_VERSION_MINOR_TUPLE\" fastapi --include=*.py | grep -v \"_compat/may_v1.py\\|_compat/v1.py\" | head -80"
} | {"status": "ok", "stdout": "fastapi/dependencies/utils.py:42: may_v1,\nfastapi/dependencies/utils.py:47:from fastapi._compat.shared import annotation_is_pydantifull{"status": "ok", "stdout": "fastapi/dependencies/utils.py:42: may_v1,\nfastapi/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:326: if isinstance(param_details.field, may_v1.ModelField):\nfastapi/dependencies/utils.py:334: param_details.field.field_info, (params.Body, temp_pydantic_v1_params.Body)\nfastapi/dependencies/utils.py:394: if isinstance(arg, (FieldInfo, may_v1.FieldInfo, params.Depends))\nfastapi/dependencies/utils.py:403: temp_pydantic_v1_params.Param,\nfastapi/dependencies/utils.py:405: temp_pydantic_v1_params.Body,\nfastapi/dependencies/utils.py:412: FieldInfo, may_v1.FieldInfo, params.Depends, None\nfastapi/dependencies/utils.py:417: if isinstance(fastapi_annotation, (FieldInfo, may_v1.FieldInfo)):\nfastapi/dependencies/utils.py:425: may_v1.Undefined,\nfastapi/dependencies/utils.py:426: } or field_info.default in {RequiredParam, may_v1.RequiredParam}, (\nfastapi/dependencies/utils.py:450: elif isinstance(value, (FieldInfo, may_v1.FieldInfo)):\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:539: in (RequiredParam, may_v1.RequiredParam, Undefined),\nfastapi/dependencies/utils.py:546: elif isinstance(field_info, (params.Query, temp_pydantic_v1_params.Qu |
| 14 | run_command | {
"command": "wc -l fastapi/_compat/*.py fastapi/temp_pydantic_v1_params.py"
} | {"status": "ok", "stdout": " 49 fastapi/_compat/__init__.py\n 264 fastapi/_compat/main.py\n 124 fastapi/_compat/may_v1.py\n 50 fastapi/_compat/model_field.py\n full{"status": "ok", "stdout": " 49 fastapi/_compat/__init__.py\n 264 fastapi/_compat/main.py\n 124 fastapi/_compat/may_v1.py\n 50 fastapi/_compat/model_field.py\n 194 fastapi/_compat/shared.py\n 222 fastapi/_compat/v1.py\n 571 fastapi/_compat/v2.py\n 718 fastapi/temp_pydantic_v1_params.py\n 2192 total\n", "exit_code": 0} |
| 15 | read_file | {
"filepath": "fastapi/_compat/shared.py"
} | {"status": "ok", "filepath": "fastapi/_compat/shared.py", "content": "import sys\nimport types\nimport typing\nfrom collections import deque\nfrom collections.afull{"status": "ok", "filepath": "fastapi/_compat/shared.py", "content": "import sys\nimport types\nimport typing\nfrom collections import deque\nfrom collections.abc import Mapping, Sequence\nfrom dataclasses import is_dataclass\nfrom typing import (\n Annotated,\n Any,\n Union,\n)\n\nfrom fastapi._compat import may_v1\nfrom fastapi.types import UnionType\nfrom pydantic import BaseModel\nfrom pydantic.version import VERSION as PYDANTIC_VERSION\nfrom starlette.datastructures import UploadFile\nfrom typing_extensions import get_args, get_origin\n\n# Copy from Pydantic v2, compatible with v1\nif sys.version_info < (3, 10):\n WithArgsTypes: tuple[Any, ...] = (typing._GenericAlias, types.GenericAlias) # type: ignore[attr-defined]\nelse:\n WithArgsTypes: tuple[Any, ...] = (\n typing._GenericAlias, # type: ignore[attr-defined]\n types.GenericAlias,\n types.UnionType,\n ) # pyright: ignore[reportAttributeAccessIssue]\n\nPYDANTIC_VERSION_MINOR_TUPLE = tuple(int(x) for x in PYDANTIC_VERSION.split(\".\")[:2])\nPYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE[0] == 2\n\n\nsequence_annotation_to_type = {\n Sequence: list,\n list: list,\n tuple: tuple,\n set: set,\n frozenset: frozenset,\n deque: deque,\n}\n\nsequence_types = tuple(sequence_annotation_to_type.keys())\n\nUrl: type[Any]\n\n\n# Copy of Pydantic v2, compatible with v1\ndef lenient_issubclass(\n cls: Any, class_or_tuple: Union[type[Any], tuple[type[Any], ...], None]\n) -> bool:\n try:\n return isinstance(cls, type) and issubclass(cls, class_or_tuple) # type: ignore[arg-type]\n except TypeError: # pragma: no cover\n if isinstance(cls, WithArgsTypes):\n return False\n raise # pragma: no cover\n\n\ndef _annotation_is_sequence(annotation: Union[type[Any], None]) -> bool:\n if lenient_issubclass(annotation, (str, bytes)):\n return False\n return lenient_issubclass(annotation, sequence_types)\n\n\ndef field_annotation |
| 16 | read_file | {
"filepath": "fastapi/_compat/main.py"
} | {"status": "ok", "filepath": "fastapi/_compat/main.py", "content": "import sys\nfrom collections.abc import Sequence\nfrom functools import lru_cache\nfrom typifull{"status": "ok", "filepath": "fastapi/_compat/main.py", "content": "import sys\nfrom collections.abc import Sequence\nfrom functools import lru_cache\nfrom typing import (\n Any,\n)\n\nfrom fastapi._compat import may_v1\nfrom fastapi._compat.shared import lenient_issubclass\nfrom fastapi.types import ModelNameMap\nfrom pydantic import BaseModel\nfrom typing_extensions import Literal\n\nfrom . import v2\nfrom .model_field import ModelField\nfrom .v2 import BaseConfig as BaseConfig\nfrom .v2 import FieldInfo as FieldInfo\nfrom .v2 import PydanticSchemaGenerationError as PydanticSchemaGenerationError\nfrom .v2 import RequiredParam as RequiredParam\nfrom .v2 import Undefined as Undefined\nfrom .v2 import UndefinedType as UndefinedType\nfrom .v2 import Url as Url\nfrom .v2 import Validator as Validator\nfrom .v2 import evaluate_forwardref as evaluate_forwardref\nfrom .v2 import get_missing_field_error as get_missing_field_error\nfrom .v2 import (\n with_info_plain_validator_function as with_info_plain_validator_function,\n)\n\n\n@lru_cache\ndef get_cached_model_fields(model: type[BaseModel]) -> list[ModelField]:\n if lenient_issubclass(model, may_v1.BaseModel):\n from fastapi._compat import v1\n\n return v1.get_model_fields(model) # type: ignore[arg-type,return-value]\n else:\n from . import v2\n\n return v2.get_model_fields(model) # type: ignore[return-value]\n\n\ndef _is_undefined(value: object) -> bool:\n if isinstance(value, may_v1.UndefinedType):\n return True\n\n return isinstance(value, v2.UndefinedType)\n\n\ndef _get_model_config(model: BaseModel) -> Any:\n if isinstance(model, may_v1.BaseModel):\n from fastapi._compat import v1\n\n return v1._get_model_config(model)\n\n return v2._get_model_config(model)\n\n\ndef _model_dump(\n model: BaseModel, mode: Literal[\"json\", \"python\"] = \"json\", **kwargs: Any\n) -> Any:\n if isinstance(model, may_v1.BaseModel):\n from fastapi._c |
| 17 | run_command | {
"command": "sed -n '150,194p' fastapi/_compat/shared.py; echo ===MAIN===; sed -n '150,264p' fastapi/_compat/main.py"
} | {"status": "ok", "stdout": "\n\ndef is_bytes_sequence_annotation(annotation: Any) -> bool:\n origin = get_origin(annotation)\n if origin is Union or origin is Ufull{"status": "ok", "stdout": "\n\ndef is_bytes_sequence_annotation(annotation: Any) -> bool:\n origin = get_origin(annotation)\n if origin is Union or origin is UnionType:\n at_least_one = False\n for arg in get_args(annotation):\n if is_bytes_sequence_annotation(arg):\n at_least_one = True\n continue\n return at_least_one\n return field_annotation_is_sequence(annotation) and all(\n is_bytes_or_nonable_bytes_annotation(sub_annotation)\n for sub_annotation in get_args(annotation)\n )\n\n\ndef is_uploadfile_sequence_annotation(annotation: Any) -> bool:\n origin = get_origin(annotation)\n if origin is Union or origin is UnionType:\n at_least_one = False\n for arg in get_args(annotation):\n if is_uploadfile_sequence_annotation(arg):\n at_least_one = True\n continue\n return at_least_one\n return field_annotation_is_sequence(annotation) and all(\n is_uploadfile_or_nonable_uploadfile_annotation(sub_annotation)\n for sub_annotation in get_args(annotation)\n )\n\n\ndef annotation_is_pydantic_v1(annotation: Any) -> bool:\n if lenient_issubclass(annotation, may_v1.BaseModel):\n return True\n origin = get_origin(annotation)\n if origin is Union or origin is UnionType:\n for arg in get_args(annotation):\n if lenient_issubclass(arg, may_v1.BaseModel):\n return True\n if field_annotation_is_sequence(annotation):\n for sub_annotation in get_args(annotation):\n if annotation_is_pydantic_v1(sub_annotation):\n return True\n return False\n===MAIN===\n\n\ndef serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]:\n if isinstance(field, may_v1.ModelField):\n from fastapi._compat import v1\n\n return v1.serialize_sequence_value(field=field, value=value)\n\n return v2.serialize_sequence_val |
| 18 | run_command | {
"command": "grep -rn \"PYDANTIC_V2\\|PYDANTIC_VERSION_MINOR_TUPLE\\|annotation_is_pydantic_v1\" fastapi tests --include=*.py | grep -v \"fastapi/_compat/shared.py\" | head -30"
} | {"status": "ok", "stdout": "fastapi/dependencies/utils.py:47:from fastapi._compat.shared import annotation_is_pydantic_v1\nfastapi/dependencies/utils.py:494: iffull{"status": "ok", "stdout": "fastapi/dependencies/utils.py:47:from fastapi._compat.shared import annotation_is_pydantic_v1\nfastapi/dependencies/utils.py:494: if annotation_is_pydantic_v1(use_annotation):\nfastapi/dependencies/utils.py:1045: if annotation_is_pydantic_v1(BodyModel):\nfastapi/utils.py:21: annotation_is_pydantic_v1,\nfastapi/utils.py:102: annotation_is_pydantic_v1(type_)\nfastapi/routing.py:32: annotation_is_pydantic_v1,\nfastapi/routing.py:640: if annotation_is_pydantic_v1(self.response_model):\nfastapi/routing.py:680: if annotation_is_pydantic_v1(model):\nfastapi/_compat/v1.py:55:PYDANTIC_VERSION_MINOR_TUPLE = tuple(int(x) for x in PYDANTIC_VERSION.split(\".\")[:2])\nfastapi/_compat/v1.py:56:PYDANTIC_V2 = PYDANTIC_VERSION_MINOR_TUPLE[0] == 2\nfastapi/_compat/__init__.py:37:from .shared import PYDANTIC_V2 as PYDANTIC_V2\nfastapi/_compat/__init__.py:38:from .shared import PYDANTIC_VERSION_MINOR_TUPLE as PYDANTIC_VERSION_MINOR_TUPLE\nfastapi/_compat/__init__.py:39:from .shared import annotation_is_pydantic_v1 as annotation_is_pydantic_v1\nfastapi/_compat/v2.py:139: if shared.PYDANTIC_VERSION_MINOR_TUPLE >= (2, 12):\ntests/test_tutorial/test_query_params_str_validations/test_tutorial010.py:5:from fastapi._compat import PYDANTIC_VERSION_MINOR_TUPLE\ntests/test_tutorial/test_query_params_str_validations/test_tutorial010.py:128: if PYDANTIC_VERSION_MINOR_TUPLE >= (2, 10)\n", "exit_code": 0} |
| 19 | run_command | {
"command": "cd /private/workspace 2>/dev/null; head -40 tests/test_pydantic_v1_v2_01.py; echo \"===LIST===\"; head -40 tests/test_pydantic_v1_v2_list.py"
} | {"status": "ok", "stdout": "import sys\nimport warnings\nfrom typing import Any, Union\n\nfrom tests.utils import skip_module_if_py_gte_314\n\nif sys.version_infull{"status": "ok", "stdout": "import sys\nimport warnings\nfrom typing import Any, Union\n\nfrom tests.utils import skip_module_if_py_gte_314\n\nif sys.version_info >= (3, 14):\n skip_module_if_py_gte_314()\n\nfrom fastapi import FastAPI\nfrom fastapi._compat.v1 import BaseModel\nfrom fastapi.testclient import TestClient\nfrom inline_snapshot import snapshot\n\n\nclass SubItem(BaseModel):\n name: str\n\n\nclass Item(BaseModel):\n title: str\n size: int\n description: Union[str, None] = None\n sub: SubItem\n multi: list[SubItem] = []\n\n\napp = FastAPI()\n\nwith warnings.catch_warnings(record=True):\n warnings.simplefilter(\"always\")\n\n @app.post(\"/simple-model\")\n def handle_simple_model(data: SubItem) -> SubItem:\n return data\n\n @app.post(\"/simple-model-filter\", response_model=SubItem)\n def handle_simple_model_filter(data: SubItem) -> Any:\n extended_data = data.dict()\n extended_data.update({\"secret_price\": 42})\n===LIST===\nimport sys\nimport warnings\nfrom typing import Any, Union\n\nfrom tests.utils import skip_module_if_py_gte_314\n\nif sys.version_info >= (3, 14):\n skip_module_if_py_gte_314()\n\nfrom fastapi import FastAPI\nfrom fastapi._compat.v1 import BaseModel\nfrom fastapi.testclient import TestClient\nfrom inline_snapshot import snapshot\n\n\nclass SubItem(BaseModel):\n name: str\n\n\nclass Item(BaseModel):\n title: str\n size: int\n description: Union[str, None] = None\n sub: SubItem\n multi: list[SubItem] = []\n\n\napp = FastAPI()\n\n\nwith warnings.catch_warnings(record=True):\n warnings.simplefilter(\"always\")\n\n @app.post(\"/item\")\n def handle_item(data: Item) -> list[Item]:\n return [data, data]\n\n @app.post(\"/item-filter\", response_model=list[Item])\n def handle_item_filter(data: Item) -> Any:\n extended_data = data.dict()\n", "exit_code": 0} |
| 20 | run_command | {
"command": "head -50 tests/test_compat_params_v1.py; echo \"===MIXED===\"; head -40 tests/test_pydantic_v1_v2_mixed.py"
} | {"status": "ok", "stdout": "import sys\nimport warnings\nfrom typing import Optional\n\nimport pytest\nfrom fastapi.exceptions import FastAPIDeprecationWarning\full{"status": "ok", "stdout": "import sys\nimport warnings\nfrom typing import Optional\n\nimport pytest\nfrom fastapi.exceptions import FastAPIDeprecationWarning\n\nfrom tests.utils import skip_module_if_py_gte_314\n\nif sys.version_info >= (3, 14):\n skip_module_if_py_gte_314()\n\nfrom typing import Annotated\n\nfrom fastapi import FastAPI\nfrom fastapi._compat.v1 import BaseModel\nfrom fastapi.temp_pydantic_v1_params import (\n Body,\n Cookie,\n File,\n Form,\n Header,\n Path,\n Query,\n)\nfrom fastapi.testclient import TestClient\nfrom inline_snapshot import snapshot\n\n\nclass Item(BaseModel):\n name: str\n price: float\n description: Optional[str] = None\n\n\napp = FastAPI()\n\nwith warnings.catch_warnings(record=True):\n warnings.simplefilter(\"always\")\n\n @app.get(\"/items/{item_id}\")\n def get_item_with_path(\n item_id: Annotated[int, Path(title=\"The ID of the item\", ge=1, le=1000)],\n ):\n return {\"item_id\": item_id}\n\n @app.get(\"/items/\")\n def get_items_with_query(\n q: Annotated[\n Optional[str],\n===MIXED===\nimport sys\nimport warnings\nfrom typing import Any, Union\n\nfrom tests.utils import skip_module_if_py_gte_314\n\nif sys.version_info >= (3, 14):\n skip_module_if_py_gte_314()\n\nfrom fastapi import FastAPI\nfrom fastapi._compat.v1 import BaseModel\nfrom fastapi.testclient import TestClient\nfrom inline_snapshot import snapshot\nfrom pydantic import BaseModel as NewBaseModel\n\n\nclass SubItem(BaseModel):\n name: str\n\n\nclass Item(BaseModel):\n title: str\n size: int\n description: Union[str, None] = None\n sub: SubItem\n multi: list[SubItem] = []\n\n\nclass NewSubItem(NewBaseModel):\n new_sub_name: str\n\n\nclass NewItem(NewBaseModel):\n new_title: str\n new_size: int\n new_description: Union[str, None] = None\n new_sub: NewSubItem\n new_multi: list[NewSubItem] = []\n\n\n", "exit_code": 0} |