Validate the spec.validators

@param {Object} spec
@api private
423405
function checkValidators(spec) {
  if (!spec.validate) return;

  let text;
  if (spec.validate.body) {
    text = 'validate.type must be declared when using validate.body';
    assert(/json|form/.test(spec.validate.type), text);
  }

  if (spec.validate.type) {
    text = 'validate.type must be either json, form, multipart or stream';
    assert(/json|form|multipart|stream/i.test(spec.validate.type), text);
  }

  if (spec.validate.output) {
    spec.validate._outputValidator = new OutputValidator(spec.validate.output);
  }

  // default HTTP status code for failures
  if (!spec.validate.failure) {
    spec.validate.failure = 400;
  }
}
816881
def _verify_validates(self, spec, path):
        """"""
        validates = spec['validates']

        if isinstance(validates, list):
            for validator in validates:
                self._verify_validator(validator, path)
        else:
            self._verify_validator(validates, path)
719169
function (name_pattern, spec_pattern) {
            /*  step 1: match mandatory name  */
            if (typeof name_pattern === "string") {
                if (this.name() !== name_pattern)
                    return false;
            }
            else if (   typeof name_pattern === "object"
                     && name_pattern instanceof RegExp) {
                if (!(this.name().match(name_pattern)))
                    return false;
            }
            else
                throw _cs.exception("matches", "invalid name pattern");

            /*  step 2: match optional specification  */
            var spec = this.__spec;
            for (var key in spec_pattern) {
                if (!_cs.isown(spec_pattern, key))
                    continue;
                if (!_cs.isdefined(spec[key]))
                    return false;
                var value = spec_pattern[key];
                switch (typeof spec[key]) {
                    case "number":
                    case "boolean":
                        if (spec[key] !== value)
                            return false;
                        break;
                    case "string":
                        if (!(   (   typeof value === "string"
                                  && spec[key] === value)
                              || (   typeof value === "object"
                                  && value instanceof RegExp
                                  && !(spec[key].match(value)))))
                            return false;
                        break;
                }
            }
            return true;
        }
974475
function validate({ separator, transformer }) {
  /* separator */
  if (null != separator) {
    if ('string' !== typeof separator) {
      throw new Error(`The separator must be a string: "${separator}".`)
    } else if (INVALID_SEPARATOR.test(separator)) {
      throw new Error(`The separator has invalid characters: "${separator}".`)
    }
  }
  /* transformer */
  if (null != transformer) {
    if (false !== transformer
      && 'function' !== typeof transformer
      && !defaultTransformers[transformer] /* TODO Deprecate */
    ) {
      throw new Error(`The transformer must be a function: "${transformer}".`)
    }
  }
}
387304
def validation_error_message(cls, spec, backends=None):
        
        try:
            cls.validate_spec(spec, backends=backends)
        except OptionError as e:
            return e.format_options_error()
324218
function validateScript(script) {
  var valid = this._validate(script);
  validateScript.errors = this._validate.errors;
  return valid;
}
756879
function check(value, ...validators) {
    let valid = false;
    _.each(validators, (validator) => {
        return !(valid = validator(value));
    });

    if (!valid) {
        throw new TypeError('Argument is not any of the accepted types.');
    }
}
449810
function addValidator(name, validator, params) {
    var _this = this;
    var validators = validator instanceof Array ? validator : [validator];
    var validate = void 0;

    if (typeof validator === 'string') {
        validate = function validate() /*value, arg, options*/{
            return _this[validator].apply({ alias: name, _this: _this }, arguments);
        };
    } else {
        validate = function validate(value /*arg, options*/) {
            var args = Array.prototype.slice.call(arguments, 2);
            var arg1 = arguments[1];
            var arg2 = arguments[2];
            var _this2 = this && this._this || _this;
            var isSimpleArgsFormat = _this2[name][SIMPLE_ARGS_FORMAT] || _this2[SIMPLE_ARGS_FORMAT];
            var isOneOptionsArg = _this2[name][ONE_OPTIONS_ARG] || _this2[ONE_OPTIONS_ARG];
            var options = !isOneOptionsArg && isPlainObject(arg2) ? arg2 : {};

            if (arg1 != null && typeof arg1 !== 'boolean') {
                if (isPlainObject(arg1)) {
                    options = arg1;
                } else {
                    options[_this2[name][ARG] || _this2[ARG]] = arg1;

                    if (!isSimpleArgsFormat) {
                        args.shift();
                    }
                }
            }

            for (var i = 0; i < validators.length; i++) {
                var base = validators[i];

                switch (typeof base === 'undefined' ? 'undefined' : _typeof(base)) {
                    case 'function':
                        validator = validatorWrapper(_this2, name, base);break;

                    case 'string':
                        validator = _this2[base];break;

                    case 'object':
                        validator = _this2[base[0]];
                        options = assign({}, options, base[1]);
                }

                var error = validator.apply(this, [value, options].concat(args));

                if (error) {
                    return error;
                }
            }
        };
    }

    assign(validate, params);

    validate.curry = function () /*arg, options*/{
        var _arguments = arguments;
        //Partial application
        return function (value) {
            return validate.apply(_this, [value].concat(Array.prototype.slice.call(_arguments)));
        };
    };

    _this[name] = validate;
}
90681
async function validate(descriptor) {
  const {valid, errors} = await Package.load(descriptor)
  return {valid, errors}
}
834677
function (spec_str) {

	// Specification string
	this.specStr = spec_str;

	// Variable type
	this.VARIABLE_TYPES = ['BOOLEAN', 'FLOAT', 'INTEGER', 'NUMBER', 'STRING', 'TEXT'];
	this.type = null;

	// Range of value
	this.min = null;
	this.max = null;

	// Additonal options
	this.OPTION_KEYS = ['DEFAULT', 'REGEXP'];

	// Additonal options - Default value
	this.default = null;

	// Additonal options - Regular Expression for STRING or TEXT
	this.regExp = null;

	// ---

	// Parse the specification string
	this._parseSpec(this.specStr);

}
717829
function validate( options ) {
		var validator,
			keys,
			key,
			err;

		if ( !isObject( options ) ) {
			return new TypeError( 'Stream()::invalid input argument. Options must be an object.' );
		}
		keys = Object.keys( options );
		for ( var i = 0; i < keys.length; i++ ) {
			key = keys[ i ];
			validator = validators[ key ];
			err = validator( options[key] );
			if ( err ) {
				return err;
			}
		}
	}
596198
function req (params, spec, errs) {
  for (var key in spec) {
    if (spec[key].req && !params.hasOwnProperty(key)) reqError(key, errs)
  }
}
726584
async function validate(descriptor) {
  const {valid, errors} = await Schema.load(descriptor)
  return {valid, errors}
}
202135
function validate() {
  const target = this._obj;

  isValidation(target);
  this.assert(_.has(target, 'error') && null === target.error,
      '#{this} should validate but does not because '+getErrorMessages(target),
      '#{this} should not validate but it does'
  );
}
964832
function Validator(opts) {
	this.opts = {
		messages: deepExtend({}, defaultMessages)
	};

	if (opts)
		deepExtend(this.opts, opts);

	this.messages = this.opts.messages;
	this.messageKeys = Object.keys(this.messages);

	// Load rules
	this.rules = loadRules();
	this.cache = new Map();
}
469806
function makeValidation(name, exp, parser) {
    return function (input) {
        if (typeof input !== 'string') {
            throw new TypeError('Cannot validate ' + name + '. Input must be a string.');
        }
        var validate = function () {
            return input.match(exp) ? true : false;
        };
        return {
            valid: validate(),
            parse: function () {
                if (!validate()) {
                    return false;
                }
                var captures = exp.exec(input);
                return parser(captures);
            }
        };
    };
}
648003
function validate(config, source) {

  if (typeof config.rules === 'object') {
    Object.keys(config.rules).forEach(function(id) {
      validateRuleOptions(id, config.rules[id], source);
    });
  }
}