Skip to content

Commit 51c8418

Browse files
committed
Fix for #625
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 91c879f commit 51c8418

5 files changed

+25
-17
lines changed

dist/angular-schema-form-bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-schema-form
33
* @version 1.0.0-alpha.4
4-
* @date Mon, 03 Apr 2017 14:20:22 GMT
4+
* @date Fri, 14 Apr 2017 16:07:04 GMT
55
* @link https://github.com/json-schema-form/angular-schema-form
66
* @license MIT
77
* Copyright (c) 2014-2017 JSON Schema Form

dist/angular-schema-form-bootstrap.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-schema-form.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-schema-form
33
* @version 1.0.0-alpha.4
4-
* @date Mon, 03 Apr 2017 14:20:22 GMT
4+
* @date Fri, 14 Apr 2017 16:07:04 GMT
55
* @link https://github.com/json-schema-form/angular-schema-form
66
* @license MIT
77
* Copyright (c) 2014-2017 JSON Schema Form
@@ -3191,12 +3191,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
31913191
});
31923192
}
31933193
}
3194-
} else if (items.type && items.type.indexOf('array') !== -1) {
3195-
empty = [];
3196-
if (!scope.options || scope.options.setSchemaDefaults !== false) {
3197-
empty = items['default'] || empty;
3198-
}
31993194
} else {
3195+
if (items.type) {
3196+
if (items.type.indexOf('array') !== -1) {
3197+
empty = [];
3198+
} else if (items.type.indexOf('string') !== -1 || items.type.indexOf('number') !== -1) {
3199+
empty = '';
3200+
}
3201+
}
32003202
// No type? could still have defaults.
32013203
if (!scope.options || scope.options.setSchemaDefaults !== false) {
32023204
empty = items['default'] || empty;
@@ -3231,6 +3233,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
32313233
}
32323234
};
32333235
};
3236+
32343237
var formDefCache = {};
32353238
scope.copyWithIndex = function (index) {
32363239
var form = scope.form;

0 commit comments

Comments
 (0)