Fix deserialization for default values

This commit is contained in:
jaina heartles 2022-12-09 22:32:34 -08:00
parent 1e7900d730
commit 1c6b3aceee

View file

@ -349,10 +349,14 @@ pub fn DeserializerContext(comptime Result: type, comptime From: type, comptime
any_missing = true;
}
}
if (any_missing) {
return if (any_explicit) error.MissingField else null;
}
if (any_missing and any_explicit) return error.MissingField;
if (!any_explicit) {
inline for (info.fields) |field, i| {
if (fields_alloced[i]) self.deserializeFree(allocator, @field(result, field.name));
}
return null;
}
return result;
},