← eval8_submission_v1e

fastapi_14791

failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(timeout) · 50 tool calls · 0 s · fastapi/fastapi

Task input

🐛 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 calls (0)

#ToolArgumentsResult
No trace captured.

Patch

diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py
index 75ff2610..b1bd1980 100644
--- a/fastapi/openapi/utils.py
+++ b/fastapi/openapi/utils.py
@@ -49,9 +49,12 @@ validation_error_definition = {
         },
         "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"],
 }
+}
 
 validation_error_response_definition = {
     "title": "HTTPValidationError",

Test output

show
==================================== ERRORS ====================================
_____________ ERROR collecting tests/test_additional_properties.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/test_additional_properties.py:1: in <module>
    from fastapi import FastAPI
fastapi/__init__.py:7: in <module>
    from .applications import FastAPI as FastAPI
fastapi/applications.py:28: in <module>
    from fastapi.openapi.utils import get_openapi
E     File "/tmp/swe_work/eval8_submission_v1e/fastapi_14791/b/workspace/fastapi/openapi/utils.py", line 57
E       }
E       ^
E   SyntaxError: unmatched '}'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 error in 1.01s