fix: update pydantic to 2.12.5 for fastapi-pagination compatibility#11566
fix: update pydantic to 2.12.5 for fastapi-pagination compatibility#11566ogabrielluiz merged 16 commits intomainfrom
Conversation
…pagination warning
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughA pydantic dependency version constraint is updated from ~=2.11.0 to ~=2.12.5 in the project configuration file, adjusting the allowable release range for the pydantic library. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 error)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (42.29%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #11566 +/- ##
==========================================
- Coverage 37.32% 37.31% -0.01%
==========================================
Files 1592 1592
Lines 78279 78280 +1
Branches 11824 11824
==========================================
- Hits 29216 29214 -2
- Misses 47442 47445 +3
Partials 1621 1621
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/backend/base/pyproject.toml`:
- Line 35: Update the dependency declarations to avoid the pydantic 2.12.5 /
sqlmodel 0.0.22 incompatibility: either bump sqlmodel to >=0.0.32 (the release
that fixes Annotated field handling with Pydantic 2.12+) or constrain pydantic
to a pre-2.12 version (e.g., "pydantic<2.12"); modify the dependency line for
"pydantic" or the "sqlmodel" entry accordingly so the combination used at
runtime is compatible, and run dependency resolution/tests to verify no other
packages break (ensure pydantic-settings >=2.2.0 remains satisfied if you keep
pydantic 2.12.x).
…mpat With pydantic 2.12+, model_validate with from_attributes=True requires populate_by_name=True when using field aliases. Without this config, pydantic looks for the alias name (transaction_id) on the source object instead of the actual field name (id).
Detailed Analysis by File1.
|
| Category | Score |
|---|---|
| Security & PII | PASS |
| DRY | PASS |
| File structure | PASS |
| Code quality | PASS |
| Architecture | PASS |
| Tests | PASS (with caveats) |
Result: APPROVED WITH CAVEATS
Blocking (must be fixed before merge):
- None
Strong recommendations (should be fixed):
- Restrict SQLModel range from
>=0.0.32,<1.0.0to>=0.0.32,<0.1.0or~=0.0.32. The current range is dangerously broad for a pre-1.0 package. - Manually verify that Alembic migrations continue to work with SQLModel 0.0.32+, as changes in column metadata generation could cause unintended migrations.
Nice-to-have:
3. Migrate TransactionBase.Config to model_config dict for style consistency within the module.
4. Add a specific test for populate_by_name behavior in TransactionReadResponse.
# Conflicts: # src/lfx/src/lfx/_assets/component_index.json # uv.lock
Summary
Updates dependencies for fastapi-pagination compatibility:
Pydantic
~=2.11.0→~=2.12.5SQLModel
==0.0.22→>=0.0.32,<1.0.0TransactionReadResponse model_config fix
populate_by_name=Trueandfrom_attributes=TruetoTransactionReadResponsemodel_validatewithfrom_attributes=Truerequirespopulate_by_name=Truewhen using field aliasesSQLModel 0.0.32 Changelog
From the release notes:
This fix resolves issues where SQLModel models with
Annotatedtype hints were not properly supported in newer Pydantic versions.