File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1105,7 +1105,6 @@ class Config:
11051105 extra = "allow"
11061106
11071107 def __init__ (__pydantic_self__ , ** data : Any ) -> None :
1108- data = {key : val for key , val in data .items () if val }
11091108 super ().__init__ (** data )
11101109 __pydantic_self__ .validate_primary_key ()
11111110
@@ -1211,6 +1210,8 @@ def to_string(s):
12111210 map (to_string , res [i + offset ][1 ::2 ]),
12121211 )
12131212 )
1213+ # restore null values
1214+ fields = {key : val if val not in ["0" , "0.0" ] else None for key , val in fields .items ()}
12141215 # $ means a json entry
12151216 if fields .get ("$" ):
12161217 json_fields = json .loads (fields .pop ("$" ))
@@ -1346,7 +1347,7 @@ async def get(cls, pk: Any) -> "HashModel":
13461347 raise NotFoundError
13471348 try :
13481349 # 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 ()}
13501351 result = cls .parse_obj (document )
13511352 except TypeError as e :
13521353 log .warning (
You can’t perform that action at this time.
0 commit comments