refactor(models): Upgrade to pydantic v2

Resolves #4.
master
John Montagu, the 4th Earl of Sandvich 2024-11-25 21:57:19 -08:00
parent 71cc25dbb2
commit e11bcc2a08
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 6 additions and 8 deletions

View File

@ -47,13 +47,12 @@ class AvailabilitySchema(spec.BaseModel):
i += 1
class PlayerTeamAvailabilityRoleSchema(spec.BaseModel):
from models.player import PlayerSchema
from models.player_team_role import RoleSchema
player: PlayerSchema
player: "PlayerSchema"
playtime: int
availability: int
roles: list[RoleSchema]
roles: list["RoleSchema"]
from models.player import PlayerSchema
from models.player_team_role import RoleSchema
from models.player_team import PlayerTeam

View File

@ -20,8 +20,7 @@ spec = SpecTree(
nested_naming_strategy=nested_naming_strategy
)
class BaseModel(pydantic.v1.BaseModel):
class BaseModel(pydantic.BaseModel):
class Config:
alias_generator = to_camel
allow_population_by_field_name = True
smart_union = True
populate_by_name = True