mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
Add validation for JSON Null time field conversion.
This commit is contained in:
parent
b760489777
commit
bc425918b2
@ -1 +1 @@
|
||||
Subproject commit 943ccb22404ccf3f6e4a2f6ecd4cc0d9a3223c7e
|
||||
Subproject commit ee1220423bb0cb99df71a5c958b4f69b5f69f2e5
|
@ -2250,21 +2250,23 @@ begin
|
||||
end
|
||||
else if _field.PropertyType.QualifiedName = 'System.TTime' then
|
||||
begin
|
||||
if jvalue is TJSONString then
|
||||
_field.SetValue(TObject(AObject), ISOStrToTime(jvalue.Value))
|
||||
else
|
||||
raise EMapperException.CreateFmt
|
||||
('Cannot deserialize [%s], expected [%s] got [%s]',
|
||||
[_field.Name, 'TJSONString', jvalue.ClassName]);
|
||||
if not (jvalue is TJSONNull) then
|
||||
if jvalue is TJSONString then
|
||||
_field.SetValue(TObject(AObject), ISOStrToTime(jvalue.Value))
|
||||
else
|
||||
raise EMapperException.CreateFmt
|
||||
('Cannot deserialize [%s], expected [%s] got [%s]',
|
||||
[_field.Name, 'TJSONString', jvalue.ClassName]);
|
||||
end
|
||||
else { if _field.PropertyType.QualifiedName = 'System.Currency' then }
|
||||
begin
|
||||
if jvalue is TJSONNumber then
|
||||
_field.SetValue(TObject(AObject), TJSONNumber(jvalue).AsDouble)
|
||||
else
|
||||
raise EMapperException.CreateFmt
|
||||
('Cannot deserialize [%s], expected [%s] got [%s]',
|
||||
[_field.Name, 'TJSONNumber', jvalue.ClassName]);
|
||||
if not (jvalue is TJSONNull) then
|
||||
if jvalue is TJSONNumber then
|
||||
_field.SetValue(TObject(AObject), TJSONNumber(jvalue).AsDouble)
|
||||
else
|
||||
raise EMapperException.CreateFmt
|
||||
('Cannot deserialize [%s], expected [%s] got [%s]',
|
||||
[_field.Name, 'TJSONNumber', jvalue.ClassName]);
|
||||
end {
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user