@@ -95,7 +95,7 @@ def model_dump_hdf5(self, filepath: pathlib.Path, mode: Literal["w", "a"] = "w")
9595
9696 with h5py .File (filepath , mode ) as f :
9797 # store the model JSON schema
98- f .attrs ["_model_signature " ] = self .model_dump_json ()
98+ f .attrs ["_datastore_signature " ] = self .model_dump_json (indent = 2 )
9999 for akey , attr in self .attrs .items ():
100100 f .attrs [akey ] = attr
101101
@@ -105,7 +105,9 @@ def model_dump_hdf5(self, filepath: pathlib.Path, mode: Literal["w", "a"] = "w")
105105 del f [gkey ]
106106 h5_group = f .create_group (gkey )
107107
108- h5_group .attrs ["_model_schema" ] = json .dumps (group .model_json_schema ())
108+ h5_group .attrs ["_group_schema" ] = json .dumps (
109+ group .model_json_schema (), indent = 2
110+ )
109111 for akey , attr in group .attrs .items ():
110112 h5_group .attrs [akey ] = attr
111113
@@ -132,7 +134,7 @@ def model_validate_hdf5(cls, filepath: pathlib.Path):
132134 filepath (pathlib.Path): The path to the HDF5 file where the model data will be read and validated from.
133135 """
134136 with h5py .File (filepath , "r" ) as f :
135- self = cls .model_validate_json (f .attrs ["_model_signature " ])
137+ self = cls .model_validate_json (f .attrs ["_datastore_signature " ])
136138
137139 # loop through all groups in the model schema and load HDF5 store
138140 for gkey , group in self :
0 commit comments