Skip to content

Commit

Permalink
UPDATE: use v2 validator
Browse files Browse the repository at this point in the history
Signed-off-by: Segelzwerg <25705862+Segelzwerg@users.noreply.github.com>
  • Loading branch information
Segelzwerg committed Jul 21, 2023
1 parent 7f6b80c commit 3632b97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions whist_core/user/player.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""DAO of user."""
from typing import Optional

from pydantic import validator
from pydantic import field_validator

from whist_core.error.player_error import NegativeRatingError
from whist_core.user.user import User
Expand Down Expand Up @@ -29,7 +29,8 @@ def __eq__(self, other):
return other.username == self.username

# Pydantic will convert this into a classmethod, cls is the correct parameter
@validator('rating')
@field_validator('rating')
@classmethod
# noinspection ImproperFirstParameter
def rating_must_not_be_negative(cls, value): # pylint: disable=no-self-argument
"""
Expand Down

0 comments on commit 3632b97

Please sign in to comment.