valbort
886cd92b5e
🐛 Fix double JSON parsing from request body
Remove the 'await request.json()' call which was inadvertently left in the routing path. This ensures that the body bytes are passed directly to Pydantic's validate_json via FastAPIOptimizedJsonBytes, bypassing unnecessary Python dict allocations entirely.
2 weeks ago
valbort
40e2198b15
⚡ Cache pydantic.v1 import to minimize compatibility overhead
Moving the import of pydantic.v1 and the warnings filter to the module level avoids executing them on every single object serialization in jsonable_encoder, significantly boosting performance for Pydantic v1 backward compatibility checks.
2 weeks ago
valbort
35ea1fee95
✨ Optimize request parameter validation via synthetic models
Group validation of multiple parameters (query, path, headers, cookies) into a single Pydantic call using a dynamically generated BaseModel.
- Introduce get_grouped_adapter with lru_cache to cache synthetic models
- Replace individual parameter validation loop with validate_python
- Reconstruct FastAPI-compatible ValidationError structure to ensure complete backwards compatibility for error locations and input fields.
2 weeks ago
valbort
22aee4522f
✨ Optimize response serialization using Pydantic v2 TypeAdapter
This commit introduces a fast-path for the jsonable_encoder and directly uses TypeAdapter(Any).dump_json() and dump_python() in astapi.routing and astapi.encoders. By leveraging the Rust-based pydantic-core directly, serialization overhead for complex types is significantly reduced.
- Use TypeAdapter(Any).dump_json() in _serialize_data and _serialize_sse_item
- Add fast-path to jsonable_encoder to use TypeAdapter(Any).dump_python(mode='json')
- Update test_sse_events_with_fields to account for minified JSON output of Pydantic v2
2 weeks ago
valbort
1bffdc5f36
Optimize JSON parsing by using Pydantic V2 validate_json directly from request body bytes. - Add FastAPIOptimizedJsonBytes helper to mark bytes for optimized parsing. - Implement validate_json in ModelField to leverage pydantic-core's native JSON parsing. - Update get_request_handler to pass raw body bytes wrapped in FastAPIOptimizedJsonBytes when applicable. - Update _validate_value_with_model_field to use validate_json when receiving optimized bytes, avoiding redundant Python dict conversion.
Co-authored-by: Junie <[email protected] >
3 weeks ago
dependabot[bot]
5d5666bec5
⬆ Bump ty from 0.0.21 to 0.0.34 ( #15443 )
Signed-off-by: dependabot[bot] <[email protected] >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: svlandeg <[email protected] >
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
4 weeks ago
Sebastián Ramírez
e54e5a8980
🔖 Release version 0.136.1
1 month ago
Sofie Van Landeghem
7815a32f2e
⬆️ Update Pydantic v2 code to address deprecations ( #15101 )
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 month ago
Sebastián Ramírez
708606c982
🔖 Release version 0.136.0
2 months ago
Sofie Van Landeghem
4b264878d7
⬆️ Support free-threaded Python 3.14t ( #15149 )
2 months ago
Sebastián Ramírez
f796c346a8
🔖 Release version 0.135.4
2 months ago
Sebastián Ramírez
ae4e45c5cc
🔥 Remove April Fool's `@app.vibe()` 🤪 ( #15363 )
2 months ago
Sebastián Ramírez
1f442c454f
🔖 Release version 0.135.3
2 months ago
Sebastián Ramírez
70580da818
✨ Add support for `@app.vibe()` ( #15280 )
2 months ago
Kadir Can Ozden
fa3588c38c
✏️ Fix typo for `client_secret` in OAuth2 form docstrings ( #14946 )
2 months ago
Sebastián Ramírez
25a3697ced
🔖 Release version 0.135.2
3 months ago
Ahsan Sheraz
31bbb38074
📝 Fix duplicated words in docstrings ( #15116 )
Fix "to to" and "that that" word duplications in security module docstrings,
and "be be" in test data string.
Co-authored-by: ahsan.sheraz <[email protected] >
Co-authored-by: Claude Opus 4.6 <[email protected] >
3 months ago
Sofie Van Landeghem
98b269b51e
👷 Add `ty` to precommit ( #15091 )
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Motov Yurii <[email protected] >
3 months ago
Motov Yurii
8b0090c39b
📝 Fix doctrings for `max_digits` and `decimal_places` ( #14944 )
Fix doctrings for `max_digits` and `decimal_places`
3 months ago
Sebastián Ramírez
ca5f60ee72
🔖 Release version 0.135.1
3 months ago
Sebastián Ramírez
8a9258b169
🐛 Fix, avoid yield from a TaskGroup, only as an async context manager, closed in the request async exit stack ( #15038 )
3 months ago
Sebastián Ramírez
924a535a4f
📝 Update Skill, optimize context, trim and refactor into references ( #15031 )
3 months ago
Sebastián Ramírez
12ea7be0be
🔖 Release version 0.135.0
3 months ago
Sebastián Ramírez
2238155844
✨ Add support for Server Sent Events ( #15030 )
3 months ago
Sebastián Ramírez
d98eb74da9
🔖 Release version 0.134.0
3 months ago
Sebastián Ramírez
c01dc8b03c
📝 Update Library Agent Skill with streaming responses ( #15024 )
3 months ago
Sebastián Ramírez
749cefdeb1
✨ Add support for streaming JSON Lines and binary data with `yield` ( #15022 )
3 months ago
Sebastián Ramírez
728b097564
🔖 Release version 0.133.1
3 months ago
Sebastián Ramírez
4fce9ce172
🔧 Add FastAPI Agents Skill ( #14982 )
Co-authored-by: Sofie Van Landeghem <[email protected] >
Co-authored-by: Alejandra <[email protected] >
3 months ago
Sebastián Ramírez
daba0aa328
🔖 Release version 0.133.0
3 months ago
Sebastián Ramírez
6c68838615
🔖 Release version 0.132.1
3 months ago
Sebastián Ramírez
2686c7fbbf
♻️ Refactor logic to handle OpenAPI and Swagger UI escaping data ( #14986 )
3 months ago
Sebastián Ramírez
5c863d0718
🔖 Release version 0.132.0
3 months ago
Sebastián Ramírez
22354a2530
🔒 ️ Add `strict_content_type` checking for JSON requests ( #14978 )
3 months ago
Sebastián Ramírez
b423b73c35
🔖 Release version 0.131.0
3 months ago
Sebastián Ramírez
48e9835732
🗑️ Deprecate `ORJSONResponse` and `UJSONResponse` ( #14964 )
3 months ago
Sebastián Ramírez
eb544e704c
🔖 Release version 0.130.0
3 months ago
Sebastián Ramírez
590a5e5355
✨ Serialize JSON response with Pydantic (in Rust), when there's a Pydantic return type or response model ( #14962 )
3 months ago
Sebastián Ramírez
1e78a36b73
🔖 Release version 0.129.2
4 months ago
Sebastián Ramírez
c91fed958e
🔖 Release version 0.129.1
4 months ago
Sebastián Ramírez
e8b98d2187
🐛 Fix JSON Schema for files, use `contentMediaType` instead of `format: binary` ( #14953 )
4 months ago
Sebastián Ramírez
a2e51363c7
🔖 Release version 0.129.0
4 months ago
Sebastián Ramírez
3da206c06d
🎨 Update internal types for Python 3.10 ( #14898 )
4 months ago
Sebastián Ramírez
ad4e8e0060
➖ Drop support for Python 3.9 ( #14897 )
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
4 months ago
Sebastián Ramírez
bdd20051c4
🔖 Release version 0.128.8
4 months ago
Sebastián Ramírez
8f82c94de0
🔖 Release version 0.128.7
4 months ago
Sebastián Ramírez
25270fcee0
♻️ Simplify reading files in memory, do it sequentially instead of (fake) parallel ( #14884 )
4 months ago
Javier Sánchez Castro
df950111fe
✨ Show a clear error on attempt to include router into itself ( #14258 )
Co-authored-by: Javier Sánchez <[email protected] >
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Motov Yurii <[email protected] >
4 months ago
rijenkii
66dc695071
✨ Replace `dict` by `Mapping` on `HTTPException.headers` ( #12997 )
Co-authored-by: Alejandra <[email protected] >
Co-authored-by: Motov Yurii <[email protected] >
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
4 months ago
Sebastián Ramírez
0a4033aeee
🔖 Release version 0.128.6
4 months ago