Refractoring (#88)

Co-authored-by: João Moura <joaomdmoura@gmail.com>
This commit is contained in:
SashaXser
2024-01-10 07:04:13 +04:00
committed by GitHub
parent 40aea44470
commit 761f682d44
6 changed files with 16 additions and 28 deletions

View File

@@ -57,10 +57,7 @@ class Crew(BaseModel):
@classmethod
@field_validator("config", mode="before")
def check_config_type(cls, v: Union[Json, Dict[str, Any]]):
"""Ensures the 'config' field is a valid JSON or dictionary."""
if isinstance(v, Json):
return json.loads(v)
return v
return json.loads(v) if isinstance(v, Json) else v
@model_validator(mode="after")
def check_config(self):