Fix deserialization for default values
This commit is contained in:
parent
1e7900d730
commit
1c6b3aceee
1 changed files with 7 additions and 3 deletions
|
@ -349,10 +349,14 @@ pub fn DeserializerContext(comptime Result: type, comptime From: type, comptime
|
||||||
any_missing = true;
|
any_missing = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (any_missing) {
|
if (any_missing and any_explicit) return error.MissingField;
|
||||||
return if (any_explicit) error.MissingField else null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!any_explicit) {
|
||||||
|
inline for (info.fields) |field, i| {
|
||||||
|
if (fields_alloced[i]) self.deserializeFree(allocator, @field(result, field.name));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue