Skip to content

refactor: migrate from Pydantic v1 to Pydantic v2 - #79

Closed
MilindChatrabhuji wants to merge 1 commit into
eodcgmbh:mainfrom
MilindChatrabhuji:refactor/pydantic-v2-migration
Closed

MilindChatrabhuji wants to merge 1 commit into
eodcgmbh:mainfrom
MilindChatrabhuji:refactor/pydantic-v2-migration

Conversation

@MilindChatrabhuji

Copy link
Copy Markdown

Resolves #32.

Summary of Modernization

This Pull Request modernizes openeo-fastapi to Pydantic v2 (pydantic>=2.4.0), removing deprecated v1 patterns and ensuring seamless integration with modern FastAPI and current Python dependencies.

Upstream Reconciliation

Previous draft PR #66 was created months ago but became divergent from recent commits on main (including OIDC client enhancements from PR #67 and catalog capability endpoints from PR #77). This PR provides a fresh, clean modernization applied directly on top of current main without regressions.

Key Architectural Updates

  1. Model Configuration:
    • Migrated inner class Config: definitions across all models to model_config = ConfigDict(extra="allow", populate_by_name=True).
    • Migrated settings to pydantic_settings.BaseSettings with modern field annotations.
    • Modernized scalar root models to RootModel.
  2. Validation & Serialization:
    • Replaced legacy .dict() and .json() methods with .model_dump() and .model_dump_json().
    • Migrated legacy @validator / @root_validator to @field_validator / @model_validator.
  3. Dependency Specification:
    • Updated pyproject.toml dependency constraint to pydantic = ">=2.4.0" and added pydantic-settings.

@SerRichard

Copy link
Copy Markdown
Member

rejected and closing in favour of pre-existing MR #66 which already covers this

@SerRichard SerRichard closed this Oct 27, 2026
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.

Migrate to pydantic v2

2 participants