Skip to content

Commit

Permalink
fix: Fix ValidationError in WeaponLeaderboard.filters when passed in …
Browse files Browse the repository at this point in the history
…value is null
  • Loading branch information
seriaati committed Nov 28, 2024
1 parent 9d65138 commit 5053d97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions akasha/models/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ class WeaponLeaderboard(BaseModel):
def __parse_teammates(cls, v: list[dict[str, Any]]) -> list[LeaderboardTeammate]:
return [LeaderboardTeammate(**teammate) for teammate in v if "name" in teammate]

@field_validator("filters", mode="before")
@classmethod
def __parse_filters(cls, v: list[dict[str, Any]] | None) -> list[WeaponLeaderboardFilter]:
return [WeaponLeaderboardFilter(**filter_) for filter_ in v] if v else []


class LeaderboardCategory(BaseModel):
id: str = Field(alias="_id")
Expand Down

0 comments on commit 5053d97

Please sign in to comment.