Skip to content

Commit

Permalink
fix deprecated pydantic model Config
Browse files Browse the repository at this point in the history
PDOK-16629
  • Loading branch information
roelarents committed Nov 18, 2024
1 parent 6f57346 commit 9e0cceb
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions geopackage_validator/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
from typing import Optional, Tuple

from pydantic import BaseModel, Field, field_validator
from pydantic import BaseModel, Field, field_validator, ConfigDict
from semver import Version


Expand All @@ -10,31 +10,27 @@ class Named(BaseModel):


class ColumnDefinition(Named):
class Config:
frozen = True
model_config = ConfigDict(frozen=True)

type: str


class IndexDefinition(BaseModel):
class Config:
frozen = True
model_config = ConfigDict(frozen=True)

columns: Tuple[str, ...] = Field(min_length=1)
unique: bool = False


class ColumnMapping(BaseModel):
class Config:
frozen = True
model_config = ConfigDict(frozen=True)

src: str
dst: str


class ForeignKeyDefinition(BaseModel):
class Config:
frozen = True
model_config = ConfigDict(frozen=True)

@field_validator("columns")
@classmethod
Expand All @@ -53,8 +49,7 @@ def unique_src_columns(


class TableDefinition(Named):
class Config:
frozen = True
model_config = ConfigDict(frozen=True)

geometry_column: str = "geom"
columns: Tuple[ColumnDefinition, ...] = tuple()
Expand All @@ -67,8 +62,7 @@ class Config:


class TablesDefinition(BaseModel):
class Config:
frozen = True
model_config = ConfigDict(frozen=True)

geopackage_validator_version: str = "0"
projection: Optional[int]
Expand Down

0 comments on commit 9e0cceb

Please sign in to comment.