Commit Graph

6 Commits

Author SHA1 Message Date
majiayu000 b8a617d62f Update ValidationError schema for Pydantic V2 compatibility
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
2025-12-14 17:02:12 +08:00
Motov Yurii 812a1926f0
🐛 Fix `separate_input_output_schemas=False` with `computed_field` (#14453) 2025-12-05 21:19:30 +01:00
Sebastián Ramírez d34918abf0
Add support for `from pydantic.v1 import BaseModel`, mixed Pydantic v1 and v2 models in the same app (#14168)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-11 18:45:54 +02:00
Felix Fanghaenel e049fc4ea1
🐛 Fix openapi generation with responses kwarg (#10895)
Co-authored-by: flxdot <felix.fanghaenel@nitrex.com>
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
Co-authored-by: Sławek Ehlert <slawomir.ehlert@gmail.com>
2024-10-12 11:44:57 +02:00
Sebastián Ramírez bc935e08b6
⬆️ Upgrade compatibility with Pydantic v2.4, new renamed functions and JSON Schema input/output models with default values (#10344)
* 🚚 Refactor deprecated import general_plain_validator_function to with_info_plain_validator_function

* 🚚 Rename deprecated FieldValidationInfo to ValidationInfo

*  Update tests with new defaults for JSON Schema for default values

* ♻️ Add Pydantic v1 version of with_info_plain_validator_function

* 👷 Invalidate cache

*  Fix tests for Pydantic v1

*  Tweak tests coverage for older Pydantic v2 versions
2023-09-27 23:14:40 -05:00
Sebastián Ramírez ea43f227e5
Add support for disabling the separation of input and output JSON Schemas in OpenAPI with Pydantic v2 (#10145)
* 📝 Add docs for Separate OpenAPI Schemas for Input and Output

* 🔧 Add new docs page to MkDocs config

*  Add separate_input_output_schemas parameter to FastAPI class

* 📝 Add source examples for separating OpenAPI schemas

*  Add tests for separated OpenAPI schemas

* 📝 Add source examples for Python 3.10, 3.9, and 3.7+

* 📝 Update docs for Separate OpenAPI Schemas with new multi-version examples

*  Add and update tests for different Python versions

*  Add tests for corner cases with separate_input_output_schemas

* 📝 Update tutorial to use Union instead of Optional

* 🐛 Fix type annotations

* 🐛 Fix correct import in test

* 💄 Add CSS to simulate browser windows for screenshots

*  Add playwright as a dev dependency to automate generating screenshots

* 🔨 Add Playwright scripts to generate screenshots for new docs

* 📝 Update docs, tweak text to match screenshots

* 🍱 Add screenshots for new docs
2023-08-25 21:10:22 +02:00