File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1105,7 +1105,6 @@ class Config:
1105
1105
extra = "allow"
1106
1106
1107
1107
def __init__ (__pydantic_self__ , ** data : Any ) -> None :
1108
- data = {key : val for key , val in data .items () if val }
1109
1108
super ().__init__ (** data )
1110
1109
__pydantic_self__ .validate_primary_key ()
1111
1110
@@ -1211,6 +1210,8 @@ def to_string(s):
1211
1210
map (to_string , res [i + offset ][1 ::2 ]),
1212
1211
)
1213
1212
)
1213
+ # restore null values
1214
+ fields = {key : val if val not in ["0" , "0.0" ] else None for key , val in fields .items ()}
1214
1215
# $ means a json entry
1215
1216
if fields .get ("$" ):
1216
1217
json_fields = json .loads (fields .pop ("$" ))
@@ -1346,7 +1347,7 @@ async def get(cls, pk: Any) -> "HashModel":
1346
1347
raise NotFoundError
1347
1348
try :
1348
1349
# restore none values
1349
- document = {key : val if val != "0" else None for key , val in document .items ()}
1350
+ document = {key : val if val not in [ "0" , "0.0" ] else None for key , val in document .items ()}
1350
1351
result = cls .parse_obj (document )
1351
1352
except TypeError as e :
1352
1353
log .warning (
You can’t perform that action at this time.
0 commit comments