failed CONTEXT UNSUBMITTED agent_error · 17 tool calls · 153 s · fastapi/fastapi
🐛 Update `ValidationError` schema to include `input` and `ctx` ## Summary Related to #10787 The OpenAPI `ValidationError` schema was outdated and didn't reflect the actual error format returned by Pydantic V2. ## Changes Updated `validation_error_definition` in `fastapi/openapi/utils.py` to include: - `input`: The actual input value that caused the validation error - `ctx`: Optional context dictionary with additional error information ## Testing All existing tests pass with the updated schema. The test snapshots have been updated to reflect the new schema structure.
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "grep -n \"validation_error_definition\" fastapi/openapi/utils.py"
} | {"status": "ok", "stdout": "41:validation_error_definition = {\n435: \"ValidationError\": validation_error_definition,\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "41:validation_error_definition = {\n435: \"ValidationError\": validation_error_definition,\n", "stderr": "", "exit_code": 0} |
| 2 | run_command | {
"command": "sed -n '41,60p' fastapi/openapi/utils.py"
} | {"status": "ok", "stdout": "validation_error_definition = {\n \"title\": \"ValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"loc\": {\n \"titlefull{"status": "ok", "stdout": "validation_error_definition = {\n \"title\": \"ValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"loc\": {\n \"title\": \"Location\",\n \"type\": \"array\",\n \"items\": {\"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}]},\n },\n \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n },\n \"required\": [\"loc\", \"msg\", \"type\"],\n}\n\nvalidation_error_response_definition = {\n \"title\": \"HTTPValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"detail\": {\n", "stderr": "", "exit_code": 0} |
| 3 | edit_file | {
"filepath": "fastapi/openapi/utils.py",
"new_string": "validation_error_definition = {\n \"title\": \"ValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"loc\": {\n \"title\": \"Location\",\n \"type\": \"array\",\n \"items\": {\"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}]},\n },\n \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n \"input\": {\"title\": \"Input\", \"type\": \"anyOf\"},\n \"ctx\": {\"title\": \"Context\", \"type\": \"object\"},\n },\n \"required\": [\"loc\", \"msg\", \"type\"],\n}",
"old_string": "validation_error_definition = {\n \"title\": \"ValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"loc\": {\n \"title\": \"Location\",\n \"type\": \"array\",\n \"items\": {\"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}]},\n },\n \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n },\n \"required\": [\"loc\", \"msg\", \"type\"],\n}"
} | {"status": "ok", "filepath": "fastapi/openapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/openapi/utils.py\n+++ b/fastapi/openapi/ufull{"status": "ok", "filepath": "fastapi/openapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/openapi/utils.py\n+++ b/fastapi/openapi/utils.py\n@@ -49,6 +49,8 @@\n },\n \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n+ \"input\": {\"title\": \"Input\", \"type\": \"anyOf\"},\n+ \"ctx\": {\"title\": \"Context\", \"type\": \"object\"},\n },\n \"required\": [\"loc\", \"msg\", \"type\"],\n }\n", "is_truncated": false} |
| 4 | run_command | {
"command": "grep -r \"validation_error_definition\" tests/"
} | {"status": "error", "error_type": "CommandError", "error_message": "", "details": {"stdout": "", "stderr": "", "exit_code": 1}}full{"status": "error", "error_type": "CommandError", "error_message": "", "details": {"stdout": "", "stderr": "", "exit_code": 1}} |
| 5 | run_command | {
"command": "python -m pytest tests/test_openapi.py -q -k \"validation\""
} | {"status": "error", "error_type": "CommandError", "error_message": "ERROR: file or directory not found: tests/test_openapi.py\n\n", "details": {"stdout": "\nno full{"status": "error", "error_type": "CommandError", "error_message": "ERROR: file or directory not found: tests/test_openapi.py\n\n", "details": {"stdout": "\nno tests ran in 0.12s\n", "stderr": "ERROR: file or directory not found: tests/test_openapi.py\n\n", "exit_code": 4}} |
| 6 | run_command | {
"command": "find tests -name \"*openapi*\""
} | {"status": "ok", "stdout": "tests/test_openapi_route_extensions.py\ntests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py\ntests/test_defull{"status": "ok", "stdout": "tests/test_openapi_route_extensions.py\ntests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py\ntests/test_deprecated_openapi_prefix.py\ntests/test_openapi_servers.py\ntests/test_top_level_security_scheme_in_openapi.py\ntests/test_openapi_examples.py\ntests/test_openapi_query_parameter_extension.py\ntests/test_duplicate_models_openapi.py\ntests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py\ntests/test_openapi_schema_type.py\ntests/test_tutorial/test_openapi_webhooks\ntests/test_tutorial/test_conditional_openapi\ntests/test_tutorial/test_extending_openapi\ntests/test_tutorial/test_separate_openapi_schemas\ntests/test_tutorial/test_openapi_callbacks\ntests/test_openapi_separate_input_output_schemas.py\ntests/test_openapi_model_description_trim_on_formfeed.py\n", "stderr": "", "exit_code": 0} |
| 7 | run_command | {
"command": "grep -r \"ValidationError\" tests/ | head -20"
} | {"status": "ok", "stdout": "tests/test_multi_query_errors.py: \"$ref\": \"#/components/schemas/HTTPValidationError\"\ntests/test_multi_query_errors.py: \"Validafull{"status": "ok", "stdout": "tests/test_multi_query_errors.py: \"$ref\": \"#/components/schemas/HTTPValidationError\"\ntests/test_multi_query_errors.py: \"ValidationError\": {\ntests/test_multi_query_errors.py: \"title\": \"ValidationError\",\ntests/test_multi_query_errors.py: \"HTTPValidationError\": {\ntests/test_multi_query_errors.py: \"title\": \"HTTPValidationError\",\ntests/test_multi_query_errors.py: \"items\": {\"$ref\": \"#/components/schemas/ValidationError\"},\ntests/test_sub_callbacks.py: \"$ref\": \"#/components/schemas/HTTPValidationError\"\ntests/test_sub_callbacks.py: \"$ref\": \"#/components/schemas/HTTPValidationError\"\ntests/test_sub_callbacks.py: \"$ref\": \"#/components/schemas/HTTPValidationError\"\ntests/test_sub_callbacks.py: \"HTTPValidationError\": {\ntests/test_sub_callbacks.py: \"title\": \"HTTPValidationError\",\ntests/test_sub_callbacks.py: \"$ref\": \"#/components/schemas/ValidationError\"\ntests/test_sub_callbacks.py: \"ValidationError\": {\ntests/test_sub_callbacks.py: \"title\": \"ValidationError\",\ntests/test_get_request_body.py: \"$ref\": \"#/components/schemas/HTTPValidationError\"\ntests/test_get_request_body.py: \"HTTPValidationError\": {\ntests/test_get_request_body.py: \"title\": \"HTTPValidationError\",\ntests/test_get_request_body.py: \"items\": {\"$ref\": \"#/components/schemas/ValidationError\"},\ntests/test_get_request_body.py: \"ValidationError\": {\ntests/test_get_request_body.py: |
| 8 | run_command | {
"command": "python -m pytest tests/test_multi_query_errors.py -q"
} | {"status": "error", "error_type": "CommandError", "error_message": "..F [100%]\n=================================== FAILURES ===================================full{"status": "error", "error_type": "CommandError", "error_message": "..F [100%]\n=================================== FAILURES ===================================\n_____________________________ test_openapi_schema ______________________________\n\n def test_openapi_schema():\n> response = client.get(\"/openapi.json\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ntests/test_multi_query_errors.py:43: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n/kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:473: in get\n return super().get(\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:1053: in get\n return self.request(\n/kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:445: in request\n return super().request(\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:825: in request\n return self.send(request, auth=auth, follow_redirects=follow_redirects)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:914: in send\n response = self._send_handling_auth(\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:942: in _send_handling_auth\n response = self._send_handling_redirects(\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:979: in _send_handling_redirects\n response = self._send_single_request(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:1014: in _send_single_request\n response = transport.handle_request(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n/kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:348: in handle_request\n raise exc\n/kaggle/tmp/envs/overlays/starlet |
| 9 | run_command | {
"command": "python -m pytest tests/test_multi_query_errors.py -vv"
} | {"status": "error", "error_type": "CommandError", "error_message": "============================= test session starts ==============================\nplatform lfull{"status": "error", "error_type": "CommandError", "error_message": "============================= test session starts ==============================\nplatform linux -- Python 3.13.14, pytest-9.1.1, pluggy-1.6.0 -- /kaggle/tmp/envs/fastapi/bin/python\ncodspeed: 5.0.3 (disabled, mode: walltime, callgraph: enabled, timer_resolution: 1.0ns)\ncachedir: .pytest_cache\nrootdir: /workspace\nconfigfile: pytest.ini (WARNING: ignoring pytest config in pyproject.toml!)\nplugins: anyio-4.15.1, sugar-1.1.1, inline-snapshot-0.35.4, timeout-2.4.0, xdist-3.8.0, codspeed-5.0.3, cov-7.1.0\ncollecting ... collected 3 items\n\ntests/test_multi_query_errors.py::test_multi_query PASSED [ 33%]\ntests/test_multi_query_errors.py::test_multi_query_incorrect PASSED [ 66%]\ntests/test_multi_query_errors.py::test_openapi_schema FAILED [100%]\n\n=================================== FAILURES ===================================\n_____________________________ test_openapi_schema ______________________________\n\n def test_openapi_schema():\n> response = client.get(\"/openapi.json\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\ntests/test_multi_query_errors.py:43: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n/kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:473: in get\n return super().get(\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:1053: in get\n return self.request(\n/kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:445: in request\n return super().request(\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:825: in request\n return self.send(request, auth=auth, follow_redirects=follow_redirects)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/httpx/_client.py:914: in send\n response = self._send_handling_auth( |
| 10 | run_command | {
"command": "sed -n '40,60p' fastapi/openapi/utils.py"
} | {"status": "ok", "stdout": "\nvalidation_error_definition = {\n \"title\": \"ValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"loc\": {\n \"titfull{"status": "ok", "stdout": "\nvalidation_error_definition = {\n \"title\": \"ValidationError\",\n \"type\": \"object\",\n \"properties\": {\n \"loc\": {\n \"title\": \"Location\",\n \"type\": \"array\",\n \"items\": {\"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}]},\n },\n \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n \"input\": {\"title\": \"Input\", \"type\": \"anyOf\"},\n \"ctx\": {\"title\": \"Context\", \"type\": \"object\"},\n },\n \"required\": [\"loc\", \"msg\", \"type\"],\n}\n\nvalidation_error_response_definition = {\n \"title\": \"HTTPValidationError\",\n \"type\": \"object\",\n", "stderr": "", "exit_code": 0} |
| 11 | run_command | {
"command": "python -c \"import fastapi.openapi.utils; print(fastapi.openapi.utils.validation_error_definition)\""
} | {"status": "ok", "stdout": "{'title': 'ValidationError', 'type': 'object', 'properties': {'loc': {'title': 'Location', 'type': 'array', 'items': {'anyOf': [{'tyfull{"status": "ok", "stdout": "{'title': 'ValidationError', 'type': 'object', 'properties': {'loc': {'title': 'Location', 'type': 'array', 'items': {'anyOf': [{'type': 'string'}, {'type': 'integer'}]}}, 'msg': {'title': 'Message', 'type': 'string'}, 'type': {'title': 'Error Type', 'type': 'string'}, 'input': {'title': 'Input', 'type': 'anyOf'}, 'ctx': {'title': 'Context', 'type': 'object'}}, 'required': ['loc', 'msg', 'type']}\n", "stderr": "", "exit_code": 0} |
| 12 | edit_file | {
"filepath": "fastapi/openapi/utils.py",
"new_string": " \"input\": {\"title\": \"Input\", \"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}, {\"type\": \"boolean\"}, {\"type\": \"number\"}, {\"type\": \"array\"}, {\"type\": \"object\"}]},\n \"ctx\": {\"title\": \"Context\", \"type\": \"object\"},",
"old_string": " \"input\": {\"title\": \"Input\", \"type\": \"anyOf\"},\n \"ctx\": {\"title\": \"Context\", \"type\": \"object\"},"
} | {"status": "ok", "filepath": "fastapi/openapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/openapi/utils.py\n+++ b/fastapi/openapi/ufull{"status": "ok", "filepath": "fastapi/openapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/openapi/utils.py\n+++ b/fastapi/openapi/utils.py\n@@ -49,7 +49,7 @@\n },\n \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n- \"input\": {\"title\": \"Input\", \"type\": \"anyOf\"},\n+ \"input\": {\"title\": \"Input\", \"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}, {\"type\": \"boolean\"}, {\"type\": \"number\"}, {\"type\": \"array\"}, {\"type\": \"object\"}]},\n \"ctx\": {\"title\": \"Context\", \"type\": \"object\"},\n },\n \"required\": [\"loc\", \"msg\", \"type\"],\n", "is_truncated": false} |
| 13 | run_command | {
"command": "python -m pytest tests/test_multi_query_errors.py -q"
} | {"status": "error", "error_type": "CommandError", "error_message": "..F [100%]\n=================================== FAILURES ===================================full{"status": "error", "error_type": "CommandError", "error_message": "..F [100%]\n=================================== FAILURES ===================================\n_____________________________ test_openapi_schema ______________________________\n\n def test_openapi_schema():\n response = client.get(\"/openapi.json\")\n assert response.status_code == 200, response.text\n> assert response.json() == {\n \"openapi\": \"3.1.0\",\n \"info\": {\"title\": \"FastAPI\", \"version\": \"0.1.0\"},\n \"paths\": {\n \"/items/\": {\n \"get\": {\n \"responses\": {\n \"200\": {\n \"description\": \"Successful Response\",\n \"content\": {\"application/json\": {\"schema\": {}}},\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/HTTPValidationError\"\n }\n }\n },\n },\n },\n \"summary\": \"Read Items\",\n \"operationId\": \"read_items_items__get\",\n \"parameters\": [\n {\n \"required\": False,\n \"schema\": {\n \"title\": \"Q\",\n \"type\": \"array\",\n \"items\": {\"type\": \"integ |
| 14 | run_command | {
"command": "python -m pytest tests/test_multi_query_errors.py -vv"
} | {"status": "error", "error_type": "CommandError", "error_message": "============================= test session starts ==============================\nplatform lfull{"status": "error", "error_type": "CommandError", "error_message": "============================= test session starts ==============================\nplatform linux -- Python 3.13.14, pytest-9.1.1, pluggy-1.6.0 -- /kaggle/tmp/envs/fastapi/bin/python\ncodspeed: 5.0.3 (disabled, mode: walltime, callgraph: enabled, timer_resolution: 1.0ns)\ncachedir: .pytest_cache\nrootdir: /workspace\nconfigfile: pytest.ini (WARNING: ignoring pytest config in pyproject.toml!)\nplugins: anyio-4.15.1, sugar-1.1.1, inline-snapshot-0.35.4, timeout-2.4.0, xdist-3.8.0, codspeed-5.0.3, cov-7.1.0\ncollecting ... collected 3 items\n\ntests/test_multi_query_errors.py::test_multi_query PASSED [ 33%]\ntests/test_multi_query_errors.py::test_multi_query_incorrect PASSED [ 66%]\ntests/test_multi_query_errors.py::test_openapi_schema FAILED [100%]\n\n=================================== FAILURES ===================================\n_____________________________ test_openapi_schema ______________________________\n\n def test_openapi_schema():\n response = client.get(\"/openapi.json\")\n assert response.status_code == 200, response.text\n> assert response.json() == {\n \"openapi\": \"3.1.0\",\n \"info\": {\"title\": \"FastAPI\", \"version\": \"0.1.0\"},\n \"paths\": {\n \"/items/\": {\n \"get\": {\n \"responses\": {\n \"200\": {\n \"description\": \"Successful Response\",\n \"content\": {\"application/json\": {\"schema\": {}}},\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n |
| 15 | run_command | {
"command": "grep -r \"test_openapi_schema\" tests/ | head -20"
} | {"status": "ok", "stdout": "tests/test_multi_query_errors.py:def test_openapi_schema():\ntests/test_schema_ref_pydantic_v2.py:def test_openapi_schema(client: Tefull{"status": "ok", "stdout": "tests/test_multi_query_errors.py:def test_openapi_schema():\ntests/test_schema_ref_pydantic_v2.py:def test_openapi_schema(client: TestClient):\ntests/test_sub_callbacks.py:def test_openapi_schema():\ntests/test_get_request_body.py:def test_openapi_schema():\ntests/test_starlette_exception.py:def test_openapi_schema():\ntests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py:def test_openapi_schema():\ntests/test_security_oauth2.py:def test_openapi_schema():\ntests/test_custom_route_class.py:def test_openapi_schema():\ntests/test_openapi_servers.py:def test_openapi_schema():\ntests/test_response_code_no_body.py:def test_openapi_schema():\ntests/test_security_http_digest_optional.py:def test_openapi_schema():\ntests/test_top_level_security_scheme_in_openapi.py:def test_openapi_schema():\ntests/test_union_inherited_body.py:def test_openapi_schema():\ntests/test_reponse_set_reponse_code_empty.py:def test_openapi_schema():\ntests/test_openapi_examples.py:def test_openapi_schema():\ntests/test_modules_same_name_body/test_main.py:def test_openapi_schema():\ntests/test_regex_deprecated_params.py:def test_openapi_schema():\ntests/test_generic_parameterless_depends.py:def test_openapi_schema():\ntests/test_annotated.py:def test_openapi_schema():\ntests/test_additional_responses_bad.py:def test_openapi_schema():\n", "stderr": "", "exit_code": 0} |
| 16-17 ×2 | run_command | {
"command": "python -m pytest tests/test_multi_query_errors.py -q -x -k \"test_multi_query\""
} | {"status": "error", "error_type": "CommandError", "error_message": "..F\n=================================== FAILURES ===================================\n_____full{"status": "error", "error_type": "CommandError", "error_message": "..F\n=================================== FAILURES ===================================\n_____________________________ test_openapi_schema ______________________________\n\n def test_openapi_schema():\n response = client.get(\"/openapi.json\")\n assert response.status_code == 200, response.text\n> assert response.json() == {\n \"openapi\": \"3.1.0\",\n \"info\": {\"title\": \"FastAPI\", \"version\": \"0.1.0\"},\n \"paths\": {\n \"/items/\": {\n \"get\": {\n \"responses\": {\n \"200\": {\n \"description\": \"Successful Response\",\n \"content\": {\"application/json\": {\"schema\": {}}},\n },\n \"422\": {\n \"description\": \"Validation Error\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/HTTPValidationError\"\n }\n }\n },\n },\n },\n \"summary\": \"Read Items\",\n \"operationId\": \"read_items_items__get\",\n \"parameters\": [\n {\n \"required\": False,\n \"schema\": {\n \"title\": \"Q\",\n \"type\": \"array\",\n \"items\": {\"type\": \"integer\"},\n },\n |
diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py
index 75ff2610..9f82aa0c 100644
--- a/fastapi/openapi/utils.py
+++ b/fastapi/openapi/utils.py
@@ -49,6 +49,8 @@ validation_error_definition = {
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
+ "input": {"title": "Input", "anyOf": [{"type": "string"}, {"type": "integer"}, {"type": "boolean"}, {"type": "number"}, {"type": "array"}, {"type": "object"}]},
+ "ctx": {"title": "Context", "type": "object"},
},
"required": ["loc", "msg", "type"],
}
.F
=================================== FAILURES ===================================
_____________________________ test_openapi_schema ______________________________
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
> assert response.json() == {
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/foo": {
"post": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Foo",
"operationId": "foo_foo_post",
"requestBody": {
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/Items"}
}
},
"required": True,
},
}
}
},
"components": {
"schemas": {
"Items": {
"title": "Items",
"required": ["items"],
"type": "object",
"properties": {
"items": {
"title": "Items",
"type": "object",
"additionalProperties": {"type": "integer"},
}
},
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
},
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
"input": {"title": "Input"},
"ctx": {"title": "Context", "type": "object"},
},
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {"$ref": "#/components/schemas/ValidationError"},
}
},
},
}
},
}
E AssertionError: assert {'openapi': '...tionError'}}}} == {'openapi': '...': {...}}}}}}}
E
E Omitting 3 identical items, use -vv to show
E Differing items:
E {'components': {'schemas': {'HTTPValidationError': {'properties': {'detail': {'items': {...}, 'type': 'array', 'title'...': [...], 'title': 'Input'}, ...}, 'type': 'object', 'required': ['loc', 'msg', 'type'], 'title': 'ValidationError'}}}} != {'components': {'schemas': {'Items': {'title': 'Items', 'required': ['items'], 'type': 'object', 'properties': {'items...PValidationError', 'type': 'object', 'properties': {'detail': {'title': 'Detail', 'type': 'array', 'items': {...}}}}}}}
E Use -v to get more diff
tests/test_additional_properties.py:29: AssertionError
=============================== warnings summary ===============================
../../../../../../kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:45
/kaggle/tmp/envs/overlays/starlette-0.50.0-py3-none-any/starlette/testclient.py:45: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 1 passed, 1 warning in 1.52s