FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update ValidationError schema for Pydantic V2 compatibility by majiayu000 · Pull Request #14520 · fastapi/fastapi · GitHub

Repository navigation

Update ValidationError schema for Pydantic V2 compatibility - #14520

Closed
majiayu000 wants to merge 3 commits into
fastapi:masterfrom
majiayu000:fix/update-validation-error-schema-pydantic-v2
Closed

majiayu000 wants to merge 3 commits into
fastapi:masterfrom
majiayu000:fix/update-validation-error-schema-pydantic-v2

Conversation

Copy link
Copy Markdown

Summary

  • Add input, ctx, and url fields to the ValidationError OpenAPI definition
  • These fields are present in Pydantic V2 validation errors but were missing from the OpenAPI schema

Background

Pydantic V2 validation errors include additional fields beyond the original V1 schema:

  • input: The value that failed validation
  • ctx: Additional context about the error (optional)
  • url: Documentation URL for the error type (optional)

This update ensures the OpenAPI documentation accurately reflects the actual error response structure.

Test plan

  • All existing tests updated to expect new schema fields
  • Verified schema matches actual Pydantic V2 error output
  • All test suites pass

Fixes #10787

majiayu000 and others added 2 commits December 14, 2025 17:02
Add input, ctx, and url fields to the ValidationError OpenAPI definition
to accurately reflect the actual error structure returned by Pydantic V2.

Pydantic V2 validation errors include additional fields:
- input: The value that failed validation
- ctx: Additional context about the error (optional)
- url: Documentation URL for the error type (optional)

Fixes #10787
github-actions Bot added the conflicts Automatically generated when a PR has a merge conflict label Dec 20, 2025

Copy link
Copy Markdown
Contributor

This pull request has a merge conflict that needs to be resolved.

github-actions Bot removed the conflicts Automatically generated when a PR has a merge conflict label Dec 20, 2025

codspeed Bot commented Dec 20, 2025

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #14520 will not alter performance

Comparing majiayu000:fix/update-validation-error-schema-pydantic-v2 (d803e16) with master (5289259)1

Summary

✅ 40 untouched

Footnotes

  1. No successful run was found on master (c2c1cc8) during the generation of this report, so 5289259 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

github-actions Bot added the conflicts Automatically generated when a PR has a merge conflict label Dec 26, 2025

Copy link
Copy Markdown
Contributor

This pull request has a merge conflict that needs to be resolved.

Copy link
Copy Markdown
Member

This was fixed by #14791, will be available in FastAPI 0.128.1.

@majiayu000, thanks for your efforts!

YuriiMotov closed this Feb 4, 2026
majiayu000 deleted the fix/update-validation-error-schema-pydantic-v2 branch February 4, 2026 16:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts Automatically generated when a PR has a merge conflict

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Old HTTPValidationError and ValidationError OpenAPI entry

2 participants


Back | FazBrowse Home | New Git URL