Conversation
There was a problem hiding this comment.
Pull request overview
This PR upgrades the Cashfree Payment Gateway Python SDK from Pydantic v1 to v2, bumping the package version from 4.5.1 to 5.0.1. This is a major dependency upgrade that requires migrating all model configurations and validators to be compatible with Pydantic v2's API.
Changes:
- Updated Pydantic dependency from
>= 1.10.24, < 2to>= 2.11.7 - Migrated all Pydantic model configurations from
class Configtomodel_configdict - Replaced
@validatordecorators with@field_validatordecorators - Updated version strings across multiple configuration files
Reviewed changes
Copilot reviewed 267 out of 268 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Updated version to 5.0.1 and pydantic dependency to >= 2.11.7 |
| pyproject.toml | Updated package version to 5.0.1 |
| configuration.py | Updated SDK package version strings in both files |
| cashfree_pg/init.py | Updated version to 5.0.1 |
| cashfree_pg/models/*.py | Migrated 200+ model files from Pydantic v1 to v2 API |
| cashfree_pg/api_response.py | Added comment about Pydantic v2 compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "Python Version: {pyversion}\n"\ | ||
| "Version of the API: 2023-08-01\n"\ | ||
| "SDK Package Version: 4.3.10".\ | ||
| "SDK Package Version: 4.5.1".\ |
There was a problem hiding this comment.
The SDK package version in configuration.py is incorrectly set to 4.5.1 but should be 5.0.1 to match the version being released in setup.py and pyproject.toml.
| __properties = ["channel", "upi_id", "upi_redirect_url", "upi_expiry_minutes", "authorize_only", "authorization"] | ||
|
|
||
| @validator('channel') | ||
| @field_validator('channel') |
There was a problem hiding this comment.
The @field_validator decorator in Pydantic v2 requires mode parameter. For backward compatibility with v1 behavior, add mode='before'. Example: @field_validator('channel', mode='before')
| @@ -17,7 +17,7 @@ | |||
| import io | |||
| import warnings | |||
There was a problem hiding this comment.
Import of 'warnings' is not used.
| import warnings |
| @@ -17,7 +17,7 @@ | |||
| import io | |||
| import warnings | |||
|
|
|||
| from pydantic import validate_arguments, ValidationError | |||
| from pydantic import validate_arguments, ValidationError, Field, StrictStr, StrictBytes | |||
There was a problem hiding this comment.
Import of 'ValidationError' is not used.
| from pydantic import validate_arguments, ValidationError, Field, StrictStr, StrictBytes | |
| from pydantic import validate_arguments, Field, StrictStr, StrictBytes |
| @@ -41,10 +41,8 @@ | |||
| import base64 | |||
| import hashlib | |||
| import hmac | |||
| from pydantic import validate_arguments, ValidationError | |||
| from typing_extensions import Annotated | |||
| from typing import overload, Optional, Union, Awaitable | |||
There was a problem hiding this comment.
Import of 'overload' is not used.
Import of 'Awaitable' is not used.
| from typing import overload, Optional, Union, Awaitable | |
| from typing import Optional, Union |
| from aenum import Enum, no_arg | ||
|
|
||
|
|
||
| from pydantic import Field |
There was a problem hiding this comment.
Import of 'Field' is not used.
Raising PR to github