Upgrade to FastAPI 0.124.0 with modern patterns#32
Merged
gensecai-dev merged 1 commit intomainfrom Dec 7, 2025
Merged
Conversation
## Dependencies Updated
- FastAPI: 0.115.4 → 0.124.0
- Pydantic: 2.9.2 → 2.10.3
- Pydantic-settings: 2.6.1 → 2.7.0
- Uvicorn: 0.32.0 → 0.32.1
- Starlette: → 0.45.2
- Added: annotated-doc for Doc type hints
## New Features Implemented
### Annotated Type Hints with Doc
- Dependencies use `Annotated[Type, Doc("description")]` for better docs
- Created typed dependency aliases: `DatabaseSession`, `RequiredAPIKey`
- Enhanced parameter documentation in headers
### Enhanced Pydantic Models
- Added `json_schema_extra` with examples for all request/response models
- Implemented `@computed_field` for derived properties (is_complete, duration_seconds)
- Added validation constraints (ge, le) to numeric fields
- Full `Annotated[Type, Field(...), Doc(...)]` pattern
### Improved OpenAPI Documentation
- Added tag descriptions for endpoint grouping
- Enhanced API description with markdown formatting
- Configured Swagger UI parameters (deepLinking, persistAuthorization)
- Added response schemas for error cases (400, 401, 429, 503)
- Enabled `separate_input_output_schemas` for cleaner schema generation
### Code Quality
- Consistent use of `status.HTTP_*` constants
- Better error responses with structured error objects
- Type hints throughout codebase
gensecai-dev
approved these changes
Dec 7, 2025
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades FastAPI to 0.124.0 and implements modern patterns for better documentation and type safety.
Dependencies Updated
New Features Implemented
Annotated Type Hints with Doc
Annotated[Type, Doc("description")]for better OpenAPI docsDatabaseSession,RequiredAPIKey,CurrentUserEnhanced Pydantic Models
json_schema_extrawith examples for all request/response models@computed_fieldfor derived properties (is_complete,duration_seconds,total_pages)ge,le) to numeric fieldsAnnotated[Type, Field(...), Doc(...)]pattern throughoutImproved OpenAPI Documentation
separate_input_output_schemasfor cleaner schema generationCode Quality
status.HTTP_*constantsErrorResponsemodelFiles Changed
requirements.txt- Updated core dependenciesdocker/requirements-stable.txt- Updated stable dependenciesapi/dependencies.py- Typed dependency aliases with Docapi/models/job.py- Enhanced Pydantic models with computed fieldsapi/routers/convert.py- Modern endpoint definitions with response schemasapi/main.py- Enhanced OpenAPI configurationTest Plan