diff --git a/antarest/study/model.py b/antarest/study/model.py index 9c80c32b7e..547912adfb 100644 --- a/antarest/study/model.py +++ b/antarest/study/model.py @@ -19,7 +19,7 @@ from pathlib import Path from antares.study.version import StudyVersion -from pydantic import BaseModel, field_validator, field_serializer +from pydantic import BaseModel, field_serializer, field_validator from sqlalchemy import ( # type: ignore Boolean, Column, @@ -359,7 +359,7 @@ class StudyMetadataDTO(BaseModel): folder: t.Optional[str] = None tags: t.List[str] = [] - @field_serializer('version') + @field_serializer("version") def serialize_version(self, version: StudyVersion) -> int: return version.__int__() diff --git a/antarest/study/storage/rawstudy/model/filesystem/config/model.py b/antarest/study/storage/rawstudy/model/filesystem/config/model.py index aea8bb0640..8e251f96d9 100644 --- a/antarest/study/storage/rawstudy/model/filesystem/config/model.py +++ b/antarest/study/storage/rawstudy/model/filesystem/config/model.py @@ -15,7 +15,7 @@ from pathlib import Path from antares.study.version import StudyVersion -from pydantic import BaseModel, Field, model_validator, field_serializer, field_validator +from pydantic import BaseModel, Field, field_serializer, field_validator, model_validator from antarest.core.utils.utils import DTO from antarest.study.business.enum_ignore_case import EnumIgnoreCase @@ -318,7 +318,7 @@ class FileStudyTreeConfigDTO(BaseModel): enr_modelling: str = str(EnrModelling.AGGREGATED) zip_path: t.Optional[Path] = None - @field_serializer('version') + @field_serializer("version") def serialize_version(self, version: StudyVersion) -> int: return version.__int__() @@ -326,7 +326,6 @@ def serialize_version(self, version: StudyVersion) -> int: def _validate_version(cls, v: t.Any) -> StudyVersion: return StudyVersion.parse(v) - @staticmethod def from_build_config( config: FileStudyTreeConfig,