mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
Merge pull request #51 from ezequieljuliano/master
Add validation for JSON Null time field conversion
This commit is contained in:
commit
75295f62bb
@ -1 +1 @@
|
||||
Subproject commit e6dc5e937038fcdc3c5e82033d66dea0775f4267
|
||||
Subproject commit 31001af0cb56097b4a982d75c9089693a166863e
|
@ -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