Skip to content

Commit

Permalink
fix: Make ZZZStats.hia_coin an optional field
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Dec 3, 2024
1 parent e1c22b5 commit 80c9dec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions genshin/models/zzz/chronicle/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ class ZZZStats(APIModel):
shiyu_defense_frontiers: int = Aliased("cur_period_zone_layer_count")
bangboo_obtained: int = Aliased("buddy_num")
achievement_count: int
hia_coin: HIACoin = Aliased("commemorative_coins_list")
hia_coin: typing.Optional[HIACoin] = Aliased("commemorative_coins_list")

@pydantic.field_validator("hia_coin", mode="before")
def __unnest_hia_coin(cls, v: typing.List[typing.Dict[str, typing.Any]]) -> typing.Dict[str, typing.Any]:
return v[0]
def __unnest_hia_coin(
cls, v: typing.List[typing.Dict[str, typing.Any]]
) -> typing.Optional[typing.Dict[str, typing.Any]]:
return v[0] if v else None


class ZZZBaseBangboo(APIModel):
Expand Down

0 comments on commit 80c9dec

Please sign in to comment.