Skip to content

chore: use ConfigDict instead of class-based Config in API v2 schemas#243

Open
kneckinator wants to merge 1 commit into
19.0from
chore/pydantic-configdict-schemas
Open

chore: use ConfigDict instead of class-based Config in API v2 schemas#243
kneckinator wants to merge 1 commit into
19.0from
chore/pydantic-configdict-schemas

Conversation

@kneckinator

@kneckinator kneckinator commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Pydantic v2 deprecated the class-based class Config pattern. Every import of the API v2 schema modules emitted a PydanticDeprecatedSince20 warning (with a full traceback) into the Odoo server logs:

WARNING ... py.warnings: .../spp_api_v2_products/schemas/product.py:11: PydanticDeprecatedSince20:
Support for class-based `config` is deprecated, use ConfigDict instead.

This converts all API v2 resource schemas to the model_config = ConfigDict(...) form already used in spp_api_v2/schemas/base.py, silencing the warnings.

Files changed

  • spp_api_v2_products/schemas/product.py
  • spp_api_v2_products/schemas/product_category.py
  • spp_api_v2_products/schemas/uom.py
  • spp_api_v2_service_points/schemas/service_point.py
  • spp_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.py

Notes

  • Behavior is unchanged — ConfigDict is the drop-in replacement Pydantic recommends. populate_by_name and json_schema_extra are preserved verbatim.
  • No logic touched; purely a deprecation cleanup.

Test plan

  • ruff / ruff format / pylint / bandit pass via pre-commit
  • Files parse cleanly (ast.parse)

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.76%. Comparing base (2125f79) to head (1bb7984).

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
spp_api_v2_change_request 66.41% <100.00%> (-0.45%) ⬇️
spp_api_v2_cycles 70.65% <100.00%> (-0.48%) ⬇️
spp_api_v2_entitlements 69.96% <100.00%> (-0.24%) ⬇️
spp_api_v2_products 65.66% <100.00%> (-0.61%) ⬇️
spp_api_v2_service_points 70.54% <100.00%> (-0.40%) ⬇️
spp_base_common 90.26% <ø> (ø)
spp_programs 65.09% <ø> (+0.25%) ⬆️
spp_registry 86.83% <ø> (?)
spp_security 66.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...pp_api_v2_change_request/schemas/change_request.py 100.00% <100.00%> (ø)
spp_api_v2_cycles/schemas/cycle.py 100.00% <100.00%> (ø)
spp_api_v2_entitlements/schemas/entitlement.py 100.00% <100.00%> (ø)
spp_api_v2_products/schemas/product.py 100.00% <100.00%> (ø)
spp_api_v2_products/schemas/product_category.py 100.00% <100.00%> (ø)
spp_api_v2_products/schemas/uom.py 100.00% <100.00%> (ø)
spp_api_v2_service_points/schemas/service_point.py 100.00% <100.00%> (ø)

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant