Skip to content

Commit

Permalink
add typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
Seniatical committed Apr 9, 2023
1 parent f586536 commit 067a67a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ezycore/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def __get_validators__(cls):

@classmethod
def validate(cls, v, field: ModelField):
type_ = field.outer_type_.__args__[0]
type_: Model = field.outer_type_.__args__[0]

if isinstance(v, type_):
return v

primary_key = type_._config.search_by
primary_key: str = type_._config.search_by

primary_field = type_.__fields__.get(primary_key)
primary_field: ModelField = type_.__fields__.get(primary_key)
valid_value, err = primary_field.validate(v, {}, loc=primary_key)
if err:
raise ValidationError([err], cls)
Expand Down

0 comments on commit 067a67a

Please sign in to comment.