chore: use ConfigDict instead of class-based Config in API v2 schemas#243
chore: use ConfigDict instead of class-based Config in API v2 schemas#243kneckinator wants to merge 1 commit into
Conversation
Pydantic v2 deprecated the class-based `class Config` pattern, which emitted PydanticDeprecatedSince20 warnings on every module import and cluttered the server logs. Convert all API v2 resource schemas to the `model_config = ConfigDict(...)` form already used in spp_api_v2/schemas/base.py. Behavior is unchanged; this only silences the deprecation warnings.
There was a problem hiding this comment.
Code Review
This pull request updates several Pydantic models across various schema files to use the Pydantic v2 configuration style, replacing the deprecated inner class Config with model_config = ConfigDict(...). I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #243 +/- ##
==========================================
+ Coverage 71.55% 71.76% +0.20%
==========================================
Files 977 995 +18
Lines 58265 59348 +1083
==========================================
+ Hits 41694 42590 +896
- Misses 16571 16758 +187
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Summary
Pydantic v2 deprecated the class-based
class Configpattern. Every import of the API v2 schema modules emitted aPydanticDeprecatedSince20warning (with a full traceback) into the Odoo server logs:This converts all API v2 resource schemas to the
model_config = ConfigDict(...)form already used inspp_api_v2/schemas/base.py, silencing the warnings.Files changed
spp_api_v2_products/schemas/product.pyspp_api_v2_products/schemas/product_category.pyspp_api_v2_products/schemas/uom.pyspp_api_v2_service_points/schemas/service_point.pyspp_api_v2_change_request/schemas/change_request.py(6 classes)spp_api_v2_cycles/schemas/cycle.py(2 classes)spp_api_v2_entitlements/schemas/entitlement.pyNotes
ConfigDictis the drop-in replacement Pydantic recommends.populate_by_nameandjson_schema_extraare preserved verbatim.Test plan
ruff/ruff format/pylint/banditpass via pre-commitast.parse)