File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
packages/models-library/src/models_library
src/simcore_service_dynamic_sidecar/models Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1- from typing import Annotated , TypeAlias
1+ from typing import Annotated , Any , TypeAlias
22from uuid import uuid4
33
44import arrow
5- from pydantic import StringConstraints , ValidationInfo
5+ from pydantic import GetCoreSchemaHandler , StringConstraints , ValidationInfo
6+ from pydantic_core import CoreSchema , core_schema
67
78from .basic_regex import PROPERTY_KEY_RE , SIMPLE_VERSION_RE
89from .services_regex import (
@@ -59,8 +60,10 @@ def create(cls) -> "RunID":
5960 return cls (run_id_format )
6061
6162 @classmethod
62- def __get_validators__ (cls ):
63- yield cls .validate
63+ def __get_pydantic_core_schema__ (
64+ cls , source_type : Any , handler : GetCoreSchemaHandler
65+ ) -> CoreSchema :
66+ return core_schema .no_info_after_validator_function (cls , handler (str ))
6467
6568 @classmethod
6669 def validate (cls , v : "RunID | str" , _ : ValidationInfo ) -> "RunID" :
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ async def _persist_to_disk(self) -> None:
3030 async with aiofiles .open (
3131 self ._shared_store_dir / STORE_FILE_NAME , "w"
3232 ) as data_file :
33- await data_file .write (self .json ())
33+ await data_file .write (self .model_dump_json ())
3434
3535 def post_init (self , shared_store_dir : Path ):
3636 self ._shared_store_dir = shared_store_dir
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ def test_settings_with_node_ports_storage_auth(
7373 assert (
7474 settings .NODE_PORTS_STORAGE_AUTH .STORAGE_PASSWORD .get_secret_value () == "passwd"
7575 )
76- assert "passwd" not in settings .NODE_PORTS_STORAGE_AUTH .json ()
76+ assert "passwd" not in settings .NODE_PORTS_STORAGE_AUTH .model_dump_json ()
7777
7878
7979@pytest .mark .parametrize ("envs" , [{}])
You can’t perform that action at this time.
0 commit comments