From 29caf680b219dab6cdb9606939e65a220c12de5a Mon Sep 17 00:00:00 2001 From: seria Date: Tue, 3 Dec 2024 13:29:20 +0900 Subject: [PATCH] fix: Fix default field values --- hakushin/models/gi/artifact.py | 6 +++--- hakushin/models/gi/character.py | 2 +- hakushin/models/gi/weapon.py | 2 +- hakushin/models/hsr/character.py | 2 +- hakushin/models/hsr/light_cone.py | 2 +- hakushin/models/hsr/relic.py | 6 +++--- hakushin/models/zzz/bangboo.py | 2 +- hakushin/models/zzz/disc.py | 6 +++--- hakushin/models/zzz/weapon.py | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hakushin/models/gi/artifact.py b/hakushin/models/gi/artifact.py index f8f81f5..37e2e09 100644 --- a/hakushin/models/gi/artifact.py +++ b/hakushin/models/gi/artifact.py @@ -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]: @@ -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: diff --git a/hakushin/models/gi/character.py b/hakushin/models/gi/character.py index 4f42acb..edfa723 100644 --- a/hakushin/models/gi/character.py +++ b/hakushin/models/gi/character.py @@ -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: diff --git a/hakushin/models/gi/weapon.py b/hakushin/models/gi/weapon.py index 4672a03..b91afea 100644 --- a/hakushin/models/gi/weapon.py +++ b/hakushin/models/gi/weapon.py @@ -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: diff --git a/hakushin/models/hsr/character.py b/hakushin/models/hsr/character.py index 9f1d60b..b5ade53 100644 --- a/hakushin/models/hsr/character.py +++ b/hakushin/models/hsr/character.py @@ -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: diff --git a/hakushin/models/hsr/light_cone.py b/hakushin/models/hsr/light_cone.py index 61a4200..e4000eb 100644 --- a/hakushin/models/hsr/light_cone.py +++ b/hakushin/models/hsr/light_cone.py @@ -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 diff --git a/hakushin/models/hsr/relic.py b/hakushin/models/hsr/relic.py index 7cc03f9..299a18f 100644 --- a/hakushin/models/hsr/relic.py +++ b/hakushin/models/hsr/relic.py @@ -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") @@ -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") @@ -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") diff --git a/hakushin/models/zzz/bangboo.py b/hakushin/models/zzz/bangboo.py index 59fb777..47408a5 100644 --- a/hakushin/models/zzz/bangboo.py +++ b/hakushin/models/zzz/bangboo.py @@ -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") diff --git a/hakushin/models/zzz/disc.py b/hakushin/models/zzz/disc.py index e498813..09c3141 100644 --- a/hakushin/models/zzz/disc.py +++ b/hakushin/models/zzz/disc.py @@ -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") diff --git a/hakushin/models/zzz/weapon.py b/hakushin/models/zzz/weapon.py index d731ba4..a33808e 100644 --- a/hakushin/models/zzz/weapon.py +++ b/hakushin/models/zzz/weapon.py @@ -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")