fix: strict typing in BaseCRUDService + list_response_schema in BaseCRUDResource #4

Merged
i.bahlai merged 3 commits from fix/strict-typing-crud-service into 1.9.0 2026-04-04 17:46:23 +00:00

Summary

  • DCR-104: Replace all Any usage in BaseCRUDService with strict generic types (IdT, BaseModel bounds)
  • DCR-105: Add optional list_response_schema to BaseCRUDResource for separate list/detail responses

Changes

  • BaseCRUDService now uses Generic[ModelT, CreateT, UpdateT, IdT] — no more Any
  • CreateT and UpdateT bound to BaseModel
  • filters parameter typed as BaseModel instead of Any
  • BaseCRUDResource.list_response_schema (optional, defaults to response_schema)
  • Version bump to 1.8.1

Test plan

  • All 99 existing tests pass
  • ruff check passes
  • CI pipeline verification on Forgejo
## Summary - **DCR-104**: Replace all `Any` usage in `BaseCRUDService` with strict generic types (`IdT`, `BaseModel` bounds) - **DCR-105**: Add optional `list_response_schema` to `BaseCRUDResource` for separate list/detail responses ## Changes - `BaseCRUDService` now uses `Generic[ModelT, CreateT, UpdateT, IdT]` — no more `Any` - `CreateT` and `UpdateT` bound to `BaseModel` - `filters` parameter typed as `BaseModel` instead of `Any` - `BaseCRUDResource.list_response_schema` (optional, defaults to `response_schema`) - Version bump to 1.8.1 ## Test plan - [x] All 99 existing tests pass - [x] ruff check passes - [ ] CI pipeline verification on Forgejo
- Add IdT TypeVar for entity_id parameter (was Any)
- Bound CreateT/UpdateT to BaseModel (enables model_dump() without type: ignore)
- Replace filters: Any with filters: BaseModel
- Update test subclass to use 4th generic parameter
- Remove unnecessary type: ignore comments

Co-Authored-By: Paperclip <noreply@paperclip.ing>
feat(resource): add list_response_schema for separate list/detail responses
All checks were successful
CI Pipeline - Development / Code Quality Check (pull_request) Successful in 3m4s
CI Pipeline - Development / Run Tests (pull_request) Successful in 3m44s
57ceea110e
Allow BaseCRUDResource subclasses to define a lighter response schema
for list endpoints while keeping the full schema for detail/get endpoints.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
claude-bot-01 changed title from fix(crud): replace Any with strict generic types in BaseCRUDService to fix: strict typing in BaseCRUDService + list_response_schema in BaseCRUDResource 2026-04-04 13:58:24 +00:00
claude-bot-01 force-pushed fix/strict-typing-crud-service from 57ceea110e
All checks were successful
CI Pipeline - Development / Code Quality Check (pull_request) Successful in 3m4s
CI Pipeline - Development / Run Tests (pull_request) Successful in 3m44s
to 4af67dbe1d
All checks were successful
CI Pipeline - Development / Run Tests (pull_request) Successful in 1m22s
CI Pipeline - Development / Code Quality Check (pull_request) Successful in 2m4s
2026-04-04 14:26:43 +00:00
Compare
claude-bot-01 changed target branch from main to 1.9.0 2026-04-04 14:26:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
CobraPack/repository!4
No description provided.