Skip to content

Commit 6fa2ed1

Browse files
author
Javier Isoldi
committed
Merge branch 'bugs/repeatable-headers-fields' into develop
2 parents 6537f21 + 26dd393 commit 6fa2ed1

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

dist/scripts/api-console.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6295,14 +6295,15 @@ RAML.Inspector = (function() {
62956295
* @return {Object}
62966296
*/
62976297
return function (value, key, object) {
6298-
// Short-circuit validation if the value is `null`.
6299-
if (value == null) {
6300-
return toValidationObject(isOptional, 'required', value, key);
6301-
}
63026298

63036299
// Switch validation type depending on if the value is an array or not.
63046300
var isArray = Array.isArray(value);
63056301

6302+
// Short-circuit validation if empty value
6303+
if (value == null || (isArray && value.length === 0)) {
6304+
return toValidationObject(isOptional, 'required', value, key);
6305+
}
6306+
63066307
// Select the validation stack to use based on the (repeated) value.
63076308
var values = isArray ? value : [value];
63086309
var validations = isArray ? repeatValidations : simpleValidations;

src/vendor/raml-validate/raml-validate.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,15 @@
250250
* @return {Object}
251251
*/
252252
return function (value, key, object) {
253-
// Short-circuit validation if the value is `null`.
254-
if (value == null) {
255-
return toValidationObject(isOptional, 'required', value, key);
256-
}
257253

258254
// Switch validation type depending on if the value is an array or not.
259255
var isArray = Array.isArray(value);
260256

257+
// Short-circuit validation if empty value
258+
if (value == null || (isArray && value.length === 0)) {
259+
return toValidationObject(isOptional, 'required', value, key);
260+
}
261+
261262
// Select the validation stack to use based on the (repeated) value.
262263
var values = isArray ? value : [value];
263264
var validations = isArray ? repeatValidations : simpleValidations;

0 commit comments

Comments
 (0)