Skip to content

Commit

Permalink
♻ Use Pydantic v2 style field validator
Browse files Browse the repository at this point in the history
  • Loading branch information
lig committed Sep 4, 2023
1 parent d9dfed8 commit 94cec81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import FilePath, RedisDsn, SecretBytes, validator
from pydantic import FilePath, RedisDsn, SecretBytes, field_validator
from pydantic_settings import BaseSettings

__all__ = 'Settings', 'log'
Expand All @@ -24,7 +24,7 @@ def load_cached(cls, **kwargs) -> 'Settings':
_SETTINGS_CACHE = cls(**kwargs)
return _SETTINGS_CACHE

@validator('webhook_secret', 'marketplace_webhook_secret', pre=True)
@field_validator('webhook_secret', 'marketplace_webhook_secret', mode='before')
@staticmethod
def str2bytes(value: str | bytes) -> bytes:
if isinstance(value, str):
Expand Down

0 comments on commit 94cec81

Please sign in to comment.