Skip to content

Commit

Permalink
fix: Fix default field values
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Dec 3, 2024
1 parent bd8d208 commit 29caf68
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions hakushin/models/gi/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class ArtifactSetEffect(APIModel):
"""Artifact set effect."""

names: dict[Literal["EN", "KR", "CHS", "JP"], str]
name: str = Field(None) # The value of this field is assigned in post processing.
name: str = Field("") # The value of this field is assigned in post processing.
descriptions: dict[Literal["EN", "KR", "CHS", "JP"], str] = Field(alias="desc")
description: str = Field(None) # The value of this field is assigned in post processing.
description: str = Field("") # The value of this field is assigned in post processing.

@model_validator(mode="before")
def _transform_names(cls, values: dict[str, Any]) -> dict[str, Any]:
Expand All @@ -92,7 +92,7 @@ class ArtifactSet(APIModel):
rarities: list[int] = Field(alias="rank")
set_effect: ArtifactSetEffects = Field(alias="set")
names: dict[Literal["EN", "KR", "CHS", "JP"], str]
name: str = Field(None) # The value of this field is assigned in post processing.
name: str = Field("") # The value of this field is assigned in post processing.

@field_validator("icon", mode="before")
def _convert_icon(cls, value: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion hakushin/models/gi/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class Character(APIModel):
description: str = Field(alias="desc")
element: GIElement | None = None
names: dict[Literal["EN", "CHS", "KR", "JP"], str]
name: str = Field(None) # This value of this field is assigned in post processing.
name: str = Field("") # This value of this field is assigned in post processing.

@field_validator("icon", mode="before")
def _convert_icon(cls, value: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion hakushin/models/gi/weapon.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Weapon(APIModel):
rarity: Literal[1, 2, 3, 4, 5] = Field(alias="rank")
description: str = Field(alias="desc")
names: dict[Literal["EN", "CHS", "KR", "JP"], str]
name: str = Field(None) # This value of this field is assigned in post processing.
name: str = Field("") # This value of this field is assigned in post processing.

@field_validator("icon", mode="before")
def _convert_icon(cls, value: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion hakushin/models/hsr/character.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Character(APIModel):
path: HSRPath = Field(alias="baseType")
element: HSRElement = Field(alias="damageType")
names: dict[Literal["en", "cn", "kr", "jp"], str]
name: str = Field(None) # The value of this field is assigned in post processing.
name: str = Field("") # The value of this field is assigned in post processing.

@field_validator("icon", mode="before")
def _convert_icon(cls, value: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion hakushin/models/hsr/light_cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LightCone(APIModel):
description: str = Field(alias="desc")
path: HSRPath = Field(alias="baseType")
names: dict[Literal["en", "cn", "kr", "jp"], str]
name: str = Field(None) # The value of this field is assigned in post processing.
name: str = Field("") # The value of this field is assigned in post processing.

@computed_field
@property
Expand Down
6 changes: 3 additions & 3 deletions hakushin/models/hsr/relic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class Relic(APIModel):
"""HSR relic."""

id: int = Field(None) # This field is not present in the API response.
id: int = Field(0) # This field is not present in the API response.
name: str = Field(alias="Name")
description: str = Field(alias="Desc")
story: str = Field(alias="Story")
Expand Down Expand Up @@ -79,7 +79,7 @@ class RelicSetEffect(APIModel):
"""Relic set effect."""

descriptions: dict[Literal["en", "cn", "kr", "jp"], str]
description: str = Field(None) # The value of this field is assigned in post processing.
description: str = Field("") # The value of this field is assigned in post processing.
parameters: list[float] = Field(alias="ParamList")

@model_validator(mode="before")
Expand All @@ -106,7 +106,7 @@ class RelicSet(APIModel):
id: int # This field is not present in the API response.
icon: str
names: dict[Literal["en", "cn", "kr", "jp"], str]
name: str = Field(None) # The value of this field is assigned in post processing.
name: str = Field("") # The value of this field is assigned in post processing.
set_effect: RelicSetEffects = Field(alias="set")

@field_validator("icon", mode="before")
Expand Down
2 changes: 1 addition & 1 deletion hakushin/models/zzz/bangboo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Bangboo(APIModel):
rarity: Literal["S", "A"] | None = Field(alias="rank")
code_name: str = Field(alias="codename")
description: str = Field(alias="desc")
name: str = Field(None) # This field doesn't exist in the API response
name: str = Field("") # This field doesn't exist in the API response
names: dict[Literal["EN", "JA", "CHS", "KO"], str]

@field_validator("icon")
Expand Down
6 changes: 3 additions & 3 deletions hakushin/models/zzz/disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class DriveDisc(APIModel):

id: int
icon: str
name: str = Field(None) # This field doesn't exist in the API response
two_piece_effect: str = Field(None) # Same here
four_piece_effect: str = Field(None) # Same here
name: str = Field("") # This field doesn't exist in the API response
two_piece_effect: str = Field("") # Same here
four_piece_effect: str = Field("") # Same here

en_info: DriveDiscInfo | None = Field(None, alias="EN")
ko_info: DriveDiscInfo | None = Field(None, alias="KO")
Expand Down
2 changes: 1 addition & 1 deletion hakushin/models/zzz/weapon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Weapon(APIModel):

id: int
icon: str
name: str = Field(None) # This field doesn't exist in the API response
name: str = Field("") # This field doesn't exist in the API response
names: dict[Literal["EN", "JA", "CHS", "KO"], str]
specialty: ZZZSpecialty = Field(alias="type")
rarity: Literal["S", "A", "B"] = Field(alias="rank")
Expand Down

0 comments on commit 29caf68

Please sign in to comment.