@@ -89,7 +89,7 @@ def _coerceValue(self, value: Any, to: Type[T]) -> ValidationResult[T]:
89
89
)
90
90
91
91
# str -> dict
92
- if to in (dict , list ) and isinstance (value , str ): # type: ignore # (comparison-overlap)
92
+ if to in (dict , list ) and isinstance (value , str ):
93
93
return ValidationResult .ok (json .loads (value ))
94
94
95
95
try :
@@ -143,10 +143,10 @@ def __init__(self) -> None:
143
143
def validate (self , value : T ) -> ValidationResult [T ]:
144
144
"""validate the value"""
145
145
if not self ._enum :
146
- return ValidationResult .ok (value )
146
+ return ValidationResult .ok (value , self . _nullable )
147
147
148
148
if self ._nullable and value is None :
149
- return ValidationResult .ok (value , True ) # type: ignore
149
+ return ValidationResult .ok (value , True )
150
150
151
151
if value not in self ._enum :
152
152
return ValidationResult .err (
@@ -177,7 +177,7 @@ def length(self, value: Any) -> int:
177
177
def validate (self , value : T ) -> ValidationResult [T ]:
178
178
"""validate the value"""
179
179
if self ._nullable and value is None :
180
- return ValidationResult .ok (value , True ) # type: ignore
180
+ return ValidationResult .ok (value , True )
181
181
182
182
if self ._min is not None :
183
183
length = self .length (value )
0 commit comments