File tree 3 files changed +3
-4
lines changed 3 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -165,11 +165,11 @@ def __post_init__(self) -> None:
165
165
Fill fields with function-factory or calling validations
166
166
"""
167
167
# checking if an attribute is already a dataclass:
168
+ errors = {}
168
169
for _ , f in self .__columns__ .items ():
169
170
value = getattr (self , f .name )
170
171
name = f .name
171
172
self ._calculate_value (name , value , f )
172
- errors = {}
173
173
try :
174
174
value = getattr (self , f .name )
175
175
error = self ._validation (name , value , f )
@@ -181,7 +181,7 @@ def __post_init__(self) -> None:
181
181
if self .Meta .strict is True :
182
182
raise ValidationError (
183
183
f"""{ self .modelName } : There are errors in your Model. Hint: please check the "payload" attribute in the exception.""" ,
184
- payload = errors
184
+ payload = errors
185
185
)
186
186
self .__errors__ = errors
187
187
object .__setattr__ (self , "__valid__" , False )
Original file line number Diff line number Diff line change @@ -52,7 +52,6 @@ def to_dict(self):
52
52
return self .remove_nulls (asdict (self , dict_factory = dict ))
53
53
return asdict (self )
54
54
55
-
56
55
def json (self , ** kwargs ):
57
56
encoder = self .__encoder__ (** kwargs )
58
57
return encoder (asdict (self ))
Original file line number Diff line number Diff line change 3
3
__title__ = 'python-datamodel'
4
4
__description__ = ('simple library based on python +3.8 to use Dataclass-syntax'
5
5
'for interacting with Data' )
6
- __version__ = '0.3.11 '
6
+ __version__ = '0.3.12 '
7
7
__author__ = 'Jesus Lara'
8
8
__author_email__ = '[email protected] '
9
9
__license__ = 'BSD'
You can’t perform that action at this time.
0 commit comments