8000 Update ValidationError schema for Pydantic V2 compatibility by majiayu000 · Pull Request #14520 · fastapi/fastapi · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@majiayu000
Copy link

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 fastapi#10787
@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Dec 20, 2025
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot removed the conflicts Automatically generated when a PR has a merge conflict label Dec 20, 2025
@codspeed-hq
Copy link
codspeed-hq bot commented Dec 20, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Old HTTPValidationError and ValidationError OpenAPI entry

1 participant

0