fix: migrate BaseModel to Pydantic V2 ConfigDict - #308
Open
dulcetberg wants to merge 1 commit into
Open
Conversation
The V1-style class-based Config is deprecated in Pydantic 2.x and scheduled for removal in V3. Migrates the shared BaseModel's config to the V2 model_config = ConfigDict(...) API. All settings (alias_generator, populate_by_name, use_enum_values) keep the same names and behavior in V2 - only the syntax changes, from a nested class to a single class attribute holding a dict-like ConfigDict object. Verified: no more class-based-config deprecation warning fires for this class, and the existing test suite still passes (5 passed). Second incremental PR toward hotosm#256, independent of hotosm#307 (branched fresh from develop rather than stacked on the unmerged first PR). Signed-off-by: Brian Bergstrom <dulcetberg@gmail.com>
This was referenced Aug 22, 2026
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
Second incremental step on #256 (see #307 for the first) — migrates the shared
BaseModel's class-basedConfigto Pydantic V2'smodel_config = ConfigDict(...)API.Branched independently from
developrather than stacked on #307, so this is reviewable/mergeable on its own regardless of #307's status.All settings keep the same names and behavior (
alias_generator,populate_by_name,use_enum_values) — only the syntax moves from a nested class to a single class attribute.Remaining scope for #256 (per maintainer's review on #307): 8 more
@validatorusages and 3 moreclass Configblocks in this same file, planned as further small incremental PRs.Test plan
BaseModelafter the changepytest tests/test_app.py— 5 passed, 0 failed