Skip to content

Commit b717fc0

Browse files
author
Klaus Krapfenbauer
committed
This doesn't remove the error it removes it when an array of strings or numbers is specified and fails validation by inserting null to force a value into the array.
1 parent b0af968 commit b717fc0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/directives/newArray.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,16 @@ function(sel, sfPath, schemaForm) {
172172
}
173173
}
174174

175-
} else if (items.type && items.type.indexOf('array') !== -1) {
176-
empty = [];
177-
if (!scope.options || scope.options.setSchemaDefaults !== false) {
178-
empty = items['default'] || empty;
175+
}
176+
else {
177+
if (items.type) {
178+
if(items.type.indexOf('array') !== -1) {
179+
empty = [];
180+
}
181+
else if(items.type.indexOf('string') !== -1 || items.type.indexOf('number') !== -1) {
182+
empty = '';
183+
}
179184
}
180-
} else {
181185
// No type? could still have defaults.
182186
if (!scope.options || scope.options.setSchemaDefaults !== false) {
183187
empty = items['default'] || empty;

0 commit comments

Comments
 (0)