Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions dist/scripts/api-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -6311,14 +6311,15 @@ RAML.Inspector = (function() {
* @return {Object}
*/
return function (value, key, object) {
// Short-circuit validation if the value is `null`.
if (value == null) {
return toValidationObject(isOptional, 'required', value, key);
}

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

// Short-circuit validation if empty value
if (value == null || (isArray && value.length === 0)) {
return toValidationObject(isOptional, 'required', value, key);
}

// Select the validation stack to use based on the (repeated) value.
var values = isArray ? value : [value];
var validations = isArray ? repeatValidations : simpleValidations;
Expand Down
9 changes: 5 additions & 4 deletions src/vendor/raml-validate/raml-validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,15 @@
* @return {Object}
*/
return function (value, key, object) {
// Short-circuit validation if the value is `null`.
if (value == null) {
return toValidationObject(isOptional, 'required', value, key);
}

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

// Short-circuit validation if empty value
if (value == null || (isArray && value.length === 0)) {
return toValidationObject(isOptional, 'required', value, key);
}

// Select the validation stack to use based on the (repeated) value.
var values = isArray ? value : [value];
var validations = isArray ? repeatValidations : simpleValidations;
Expand Down