Skip to content

Commit 9185430

Browse files
authored
Merge pull request #36 from geeshta/feature/pydantic-2.8.2
Merge branch Feature/pydantic 2.8.2
2 parents 0bf3ef9 + 4b1facd commit 9185430

5 files changed

Lines changed: 457 additions & 352 deletions

File tree

.github/workflows/python-app.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
runs-on: ubuntu-20.04
1313
strategy:
1414
matrix:
15-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1616

1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v5
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323
- name: Install Poetry

gopay/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def payments(config: dict, services: dict | None = None) -> Payments:
2323
del config[key]
2424

2525
# Use Pydantic to validate the config object
26-
config_model = GopayConfig.parse_obj(config)
27-
config = config_model.dict()
26+
config_model = GopayConfig.model_validate(config)
27+
config = config_model.model_dump()
2828

2929
# Create and return the Payments and GoPay objects
3030
gopay = GoPay(config, services or {})

gopay/models.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
from __future__ import annotations
22

3-
from pydantic import BaseModel, Extra
3+
from pydantic import BaseModel, ConfigDict
44
from typing import Optional
5+
56
from gopay import enums
67

78

89
class GopayModel(BaseModel):
9-
class Config:
10-
use_enum_values = True
11-
extra = Extra.forbid
10+
model_config = ConfigDict(use_enum_values=True, extra="forbid")
1211

1312

1413
class GopayConfig(GopayModel):

0 commit comments

Comments
 (0)