fix: Set falsy values as default to schema fields (#5868)

This commit is contained in:
Lucas Alencar
2019-07-30 17:51:49 -03:00
committed by Diamond Lewis
parent 218c3499f9
commit 6080dbc4f9
2 changed files with 9 additions and 1 deletions

View File

@@ -338,7 +338,8 @@ RestWrite.prototype.setRequiredFieldsIfNeeded = function() {
if (
setDefault &&
schema.fields[fieldName] &&
schema.fields[fieldName].defaultValue &&
schema.fields[fieldName].defaultValue !== null &&
schema.fields[fieldName].defaultValue !== undefined &&
(this.data[fieldName] === undefined ||
(typeof this.data[fieldName] === 'object' &&
this.data[fieldName].__op === 'Delete'))